1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const
|
13 | fs = require('fs'),
|
14 | windowslib = require('..');
|
15 |
|
16 | describe('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 | });
|