index.test.js
1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
'use strict';
const expect = require('chai').expect
, discovery = require('./index')
;
describe('discovery', () => {
describe('#nupnpSearch()', () => {
it('should discover a bridge', async () => {
const results = await discovery.nupnpSearch();
expect(results).to.be.instanceOf(Array);
expect(results[0]).to.have.property('name');
expect(results[0]).to.have.property('ipaddress');
expect(results[0]).to.have.property('modelid');
expect(results[0]).to.have.property('swversion');
});
});
describe('#upnpSearch()', function () {
this.timeout(10000);
it('should discover a bridge', async () => {
const results = await discovery.upnpSearch(3000);
expect(results).to.be.instanceOf(Array);
expect(results).to.have.length.greaterThan(0);
expect(results[0]).to.have.property('name');
expect(results[0]).to.have.property('ipaddress');
expect(results[0]).to.have.property('model');
expect(results[0].model).to.have.property('name');
expect(results[0].model).to.have.property('number');
expect(results[0].model).to.have.property('serial');
});
});
describe('#description()', function () {
this.timeout(10000);
let hostAddress;
before(async() => {
const results = await discovery.nupnpSearch();
expect(results).to.have.length.greaterThan(0);
hostAddress = results[0].ipaddress;
});
it('should discover a bridge', async () => {
const result = await discovery.description(hostAddress);
expect(result).to.have.property('name');
expect(result).to.have.property('ipaddress');
expect(result).to.have.property('model');
expect(result.model).to.have.property('name');
expect(result.model).to.have.property('number');
expect(result.model).to.have.property('serial');
});
});
});