UNPKG

2.38 kBJavaScriptView Raw
1/**
2 * Tests windowslib's assemblies module.
3 *
4 * @copyright
5 * Copyright (c) 2014-2015 by Appcelerator, Inc. All Rights Reserved.
6 *
7 * @license
8 * Licensed under the terms of the Apache Public License.
9 * Please see the LICENSE included with this distribution for details.
10 */
11
12const
13 fs = require('fs'),
14 windowslib = require('..');
15
16describe('assemblies', function () {
17 it('namespace should be an object', function () {
18 should(windowslib.assemblies).be.an.Object;
19 });
20
21 (process.platform === 'win32' ? it : it.skip)('detect should find required assemblies', function (done) {
22 this.timeout(5000);
23 this.slow(2000);
24
25 windowslib.assemblies.detect(function (err, results) {
26 if (err) {
27 return done(err);
28 }
29
30 should(results).be.an.Object;
31 should(results).have.keys('assemblies', 'issues');
32
33 should(results.assemblies).be.an.Object;
34 Object.keys(results.assemblies).forEach(function (assembly) {
35 if (results.assemblies[assembly] !== null) {
36 should(results.assemblies[assembly]).be.an.Object;
37 Object.keys(results.assemblies[assembly]).forEach(function (ver) {
38 should(results.assemblies[assembly][ver]).be.an.Object;
39 should(results.assemblies[assembly][ver]).have.keys('assemblyFile', 'dotNetVersion', 'assemblyVersion', 'publicKeyToken');
40
41 should(results.assemblies[assembly][ver].assemblyFile).be.a.String;
42 should(results.assemblies[assembly][ver].assemblyFile).not.equal('');
43 should(fs.existsSync(results.assemblies[assembly][ver].assemblyFile)).be.ok;
44
45 should(results.assemblies[assembly][ver].dotNetVersion).be.a.String;
46 should(results.assemblies[assembly][ver].dotNetVersion).not.equal('');
47
48 should(results.assemblies[assembly][ver].assemblyVersion).be.a.String;
49 should(results.assemblies[assembly][ver].assemblyVersion).not.equal('');
50
51 should(results.assemblies[assembly][ver].publicKeyToken).be.a.String;
52 should(results.assemblies[assembly][ver].publicKeyToken).not.equal('');
53 });
54 }
55 });
56
57 should(results.issues).be.an.Array;
58 results.issues.forEach(function (issue) {
59 should(issue).be.an.Object;
60 should(issue).have.keys('id', 'type', 'message');
61 should(issue.id).be.a.String;
62 should(issue.type).be.a.String;
63 should(issue.type).match(/^info|warning|error$/);
64 should(issue.message).be.a.String;
65 });
66
67 done();
68 });
69 });
70});