index.test.js
1.06 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
'use strict';
const expect = require('chai').expect
, v3Api = require('./index')
, discovery = require('../v3').discovery
, testValues = require('../../test/support/testValues.js')
;
describe('Hue API create for local connections', () => {
let hueLocalIpAddress;
before(() => {
return discovery.nupnpSearch()
.then(searchResults => {
hueLocalIpAddress = searchResults[0].ipaddress;
});
});
describe('#createLocal()', () => {
it('should get a local connection', async () => {
const bootstrap = await v3Api.createLocal(hueLocalIpAddress);
expect(bootstrap).to.not.be.null;
const api = await bootstrap.connect(testValues.username);
expect(api).to.not.be.null;
});
});
describe('#createInsecureLocal()', () => {
it('should get an insecure local connection', async () => {
const bootstrap = await v3Api.createInsecureLocal(hueLocalIpAddress);
expect(bootstrap).to.not.be.null;
const api = await bootstrap.connect(testValues.username);
expect(api).to.not.be.null;
});
});
});