1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const
|
13 | fs = require('fs'),
|
14 | windowslib = require('..');
|
15 |
|
16 | describe('winstore', function () {
|
17 | it('namespace should be an object', function () {
|
18 | should(windowslib.winstore).be.an.Object;
|
19 | });
|
20 |
|
21 | it.skip('launch should launch Windows Store App', function (done) {
|
22 | this.timeout(10000);
|
23 | this.slow(2000);
|
24 |
|
25 | var appid = 'com.appcelerator.launch.test',
|
26 | opts = { windowsAppId: 'App' };
|
27 |
|
28 | windowslib.winstore.launch(appid, opts, done);
|
29 | });
|
30 |
|
31 |
|
32 |
|
33 | (process.platform === 'win32' ? it : it.skip)('getAppxPackages should have preset Windows packages', function (done) {
|
34 | this.timeout(10000);
|
35 | this.slow(1250);
|
36 |
|
37 | windowslib.winstore.getAppxPackages({}, function (err, packages) {
|
38 | if (err) {
|
39 | return done(err);
|
40 | }
|
41 |
|
42 | should(packages).be.an.Object;
|
43 |
|
44 | should(packages).have.properties('Microsoft.MicrosoftEdge', 'Microsoft.WindowsAlarms');
|
45 |
|
46 |
|
47 | Object.keys(packages).forEach(function (appid) {
|
48 | should(packages[appid]).have.properties('Name', 'Publisher',
|
49 | 'Architecture', 'Version', 'PackageFullName', 'IsFramework',
|
50 | 'PackageFamilyName', 'PublisherId', 'IsResourcePackage',
|
51 | 'IsBundle', 'IsDevelopmentMode');
|
52 |
|
53 |
|
54 | should(packages[appid].Name).be.a.String;
|
55 | should(packages[appid].Publisher).be.a.String;
|
56 | should(packages[appid].Architecture).be.a.String;
|
57 | should(packages[appid].Version).be.a.String;
|
58 | should(packages[appid].PackageFullName).be.a.String;
|
59 | should(packages[appid].IsFramework).be.a.Boolean;
|
60 | should(packages[appid].PackageFamilyName).be.a.String;
|
61 | should(packages[appid].PublisherId).be.a.String;
|
62 | should(packages[appid].IsResourcePackage).be.a.Boolean;
|
63 | should(packages[appid].IsBundle).be.a.Boolean;
|
64 | should(packages[appid].IsDevelopmentMode).be.a.Boolean;
|
65 | });
|
66 |
|
67 |
|
68 | should(packages['Microsoft.MicrosoftEdge'].Publisher).equal('CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US');
|
69 | should(packages['Microsoft.MicrosoftEdge'].Name).equal('Microsoft.MicrosoftEdge');
|
70 |
|
71 |
|
72 | should(packages['Microsoft.WindowsAlarms'].Publisher).equal('CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US');
|
73 | should(packages['Microsoft.WindowsAlarms'].Name).equal('Microsoft.WindowsAlarms');
|
74 |
|
75 |
|
76 |
|
77 | should(packages['Microsoft.Windows.Photos'].Dependencies).startWith('{').and.endWith('}');
|
78 |
|
79 | var photosVersion = packages['Microsoft.Windows.Photos'].Version;
|
80 | if (photosVersion === '17.425.10010.0') {
|
81 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.VCLibs.140.00_14.0.24123.0_x64__8wekyb3d8bbwe');
|
82 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.NET.Native.Framework.1.3_1.3.24201.0_x64__8wekyb3d8bbwe');
|
83 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x64__8wekyb3d8bbwe');
|
84 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.Windows.Photos_17.425.10010.0_neutral_split.scale-100_8wekyb3d8bbwe');
|
85 | } else if (photosVersion === '17.313.10010.0') {
|
86 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.VCLibs.140.00_14.0.24123.0_x64__8wekyb3d8bbwe');
|
87 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.NET.Native.Framework.1.3_1.3.24201.0_x64__8wekyb3d8bbwe');
|
88 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.NET.Native.Runtime.1.3_1.3.23901.0_x64__8wekyb3d8bbwe');
|
89 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.Windows.Photos_17.313.10010.0_neutral_split.scale-100_8wekyb3d8bbwe');
|
90 | } else if (photosVersion === '16.201.11370.0') {
|
91 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.VCLibs.140.00_14.0.22929.0_x64__8wekyb3d8bbwe');
|
92 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.NET.Native.Runtime.1.1_1.1.23406.0_x64__8wekyb3d8bbwe');
|
93 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.Windows.Photos_16.201.11370.0_neutral_split.scale-100_8wekyb3d8bbwe');
|
94 | should(packages['Microsoft.Windows.Photos'].Dependencies).containEql('Microsoft.Windows.Photos_16.201.11370.0_neutral_split.scale-150_8wekyb3d8bbwe');
|
95 | } else {
|
96 | console.log('Unknown Microsoft.Photos app version, not attempting to verify dependency listing!');
|
97 | }
|
98 | done();
|
99 | });
|
100 | });
|
101 |
|
102 | (process.platform === 'win32' ? it : it.skip)('detect should find Windows Store SDK installations', function (done) {
|
103 | this.timeout(5000);
|
104 | this.slow(2000);
|
105 |
|
106 | windowslib.winstore.detect(function (err, results) {
|
107 | if (err) {
|
108 | return done(err);
|
109 | }
|
110 |
|
111 | should(results).be.an.Object;
|
112 | should(results).have.keys('windows', 'issues');
|
113 |
|
114 | if (results.windows !== null) {
|
115 | should(results.windows).be.an.Object;
|
116 | Object.keys(results.windows).forEach(function (ver) {
|
117 | should(results.windows[ver]).be.an.Object;
|
118 | should(results.windows[ver]).have.keys('version', 'registryKey', 'supported', 'path', 'signTool', 'selected', 'makeCert', 'pvk2pfx', 'sdks');
|
119 |
|
120 | should(results.windows[ver].version).be.a.String;
|
121 | should(results.windows[ver].version).not.equal('');
|
122 |
|
123 | should(results.windows[ver].registryKey).be.a.String;
|
124 | should(results.windows[ver].registryKey).not.equal('');
|
125 |
|
126 | should(results.windows[ver].supported).be.a.Boolean;
|
127 |
|
128 | should(results.windows[ver].path).be.a.String;
|
129 | should(results.windows[ver].path).not.equal('');
|
130 | should(fs.existsSync(results.windows[ver].path)).be.ok;
|
131 |
|
132 | if (results.windows[ver].signTool !== null) {
|
133 | should(results.windows[ver].signTool).be.an.Object;
|
134 | should(results.windows[ver].signTool.x86).be.a.String;
|
135 | }
|
136 |
|
137 | should(results.windows[ver].selected).be.a.Boolean;
|
138 | });
|
139 | }
|
140 |
|
141 | should(results.issues).be.an.Array;
|
142 | results.issues.forEach(function (issue) {
|
143 | should(issue).be.an.Object;
|
144 | should(issue).have.keys('id', 'type', 'message');
|
145 | should(issue.id).be.a.String;
|
146 | should(issue.type).be.a.String;
|
147 | should(issue.type).match(/^info|warning|error$/);
|
148 | should(issue.message).be.a.String;
|
149 | });
|
150 |
|
151 | done();
|
152 | });
|
153 | });
|
154 | });
|