1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const windowslib = require('..');
|
13 |
|
14 | describe('env', function () {
|
15 | it('namespace should be an object', function () {
|
16 | should(windowslib.env).be.an.Object;
|
17 | });
|
18 |
|
19 | (process.platform === 'win32' ? it : it.skip)('detect should find dev environment dependencies', function (done) {
|
20 | this.timeout(5000);
|
21 | this.slow(4000);
|
22 |
|
23 | windowslib.env.detect(function (err, results) {
|
24 | if (err) {
|
25 | return done(err);
|
26 | }
|
27 |
|
28 | should(results).be.an.Object;
|
29 | should(results).have.keys('os', 'powershell', 'issues');
|
30 |
|
31 | should(results.os).be.an.Object;
|
32 | should(results.os).have.keys('name', 'version');
|
33 |
|
34 | if (results.os.name !== null) {
|
35 | should(results.os.name).be.a.String;
|
36 | }
|
37 |
|
38 | if (results.os.version !== null) {
|
39 | should(results.os.version).be.a.String;
|
40 | }
|
41 |
|
42 | should(results.powershell).be.an.Object;
|
43 | should(results.powershell).have.keys('enabled');
|
44 |
|
45 | if (results.os.version !== null) {
|
46 | should(results.powershell.enabled).be.a.Boolean;
|
47 | }
|
48 |
|
49 | should(results.issues).be.an.Array;
|
50 | results.issues.forEach(function (issue) {
|
51 | should(issue).be.an.Object;
|
52 | should(issue).have.keys('id', 'type', 'message');
|
53 | should(issue.id).be.a.String;
|
54 | should(issue.type).be.a.String;
|
55 | should(issue.type).match(/^info|warning|error$/);
|
56 | should(issue.message).be.a.String;
|
57 | });
|
58 |
|
59 | done();
|
60 | });
|
61 | });
|
62 | }); |
\ | No newline at end of file |