1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const
|
13 | fs = require('fs'),
|
14 | windowslib = require('..');
|
15 |
|
16 | describe('windowsphone', function () {
|
17 | it('namespace should be an object', function () {
|
18 | should(windowslib.windowsphone).be.an.Object;
|
19 | });
|
20 |
|
21 | (process.platform === 'win32' ? it : it.skip)('detect should find Windows Phone SDK installations', function (done) {
|
22 | this.timeout(5000);
|
23 | this.slow(2000);
|
24 |
|
25 | windowslib.windowsphone.detect(function (err, results) {
|
26 | if (err) {
|
27 | return done(err);
|
28 | }
|
29 |
|
30 | should(results).be.an.Object;
|
31 | should(results).have.keys('windowsphone', 'issues');
|
32 |
|
33 | if (results.windowsphone !== null) {
|
34 | should(results.windowsphone).be.an.Object;
|
35 | Object.keys(results.windowsphone).forEach(function (ver) {
|
36 | should(results.windowsphone[ver]).be.an.Object;
|
37 | should(results.windowsphone[ver]).have.keys('version', 'registryKey', 'supported', 'path', 'deployCmd', 'selected', 'xapSignTool', 'sdks');
|
38 |
|
39 | should(results.windowsphone[ver].version).be.a.String;
|
40 | should(results.windowsphone[ver].version).not.equal('');
|
41 |
|
42 | should(results.windowsphone[ver].registryKey).be.a.String;
|
43 | should(results.windowsphone[ver].registryKey).not.equal('');
|
44 |
|
45 | should(results.windowsphone[ver].supported).be.a.Boolean;
|
46 |
|
47 | should(results.windowsphone[ver].path).be.a.String;
|
48 | should(results.windowsphone[ver].path).not.equal('');
|
49 | should(fs.existsSync(results.windowsphone[ver].path)).be.ok;
|
50 |
|
51 | if (results.windowsphone[ver].deployCmd !== null) {
|
52 | should(results.windowsphone[ver].deployCmd).be.a.String;
|
53 | should(results.windowsphone[ver].deployCmd).not.equal('');
|
54 | }
|
55 |
|
56 | should(results.windowsphone[ver].selected).be.a.Boolean;
|
57 | });
|
58 | }
|
59 |
|
60 | should(results.issues).be.an.Array;
|
61 | results.issues.forEach(function (issue) {
|
62 | should(issue).be.an.Object;
|
63 | should(issue).have.keys('id', 'type', 'message');
|
64 | should(issue.id).be.a.String;
|
65 | should(issue.type).be.a.String;
|
66 | should(issue.type).match(/^info|warning|error$/);
|
67 | should(issue.message).be.a.String;
|
68 | });
|
69 |
|
70 | done();
|
71 | });
|
72 | });
|
73 | });
|