1 | 'use strict' |
||
2 | |||
3 | const chai = require('chai') |
||
4 | const expect = chai.expect |
||
5 | chai.use(require('chai-integer')) |
||
6 | chai.use(require('chai-string')) |
||
7 | |||
8 | const configuration = require('../src/configuration.js') |
||
9 | const fixtureDefaults = require('./fixtures/configuration/defaults.json') |
||
10 | |||
11 | /** |
||
12 | * Test behavior |
||
13 | * |
||
14 | * 1. Test sourceConfiguration |
||
15 | * - source: url, password |
||
16 | * - params: payload, topic |
||
17 | * 2. Test to send payloads |
||
18 | * 3. Test callback to send status |
||
19 | */ |
||
20 | describe('sourceConfiguration', () => { |
||
21 | describe('MQTT with configuration', () => { |
||
22 | let mqttConfig = configuration.mqtt(JSON.parse(JSON.stringify(fixtureDefaults))) |
||
23 | |||
24 | it('has all properties defined', (done) => { |
||
25 | expect(mqttConfig.username).to.not.be.undefined |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
26 | expect(mqttConfig.password).to.not.be.undefined |
||
0 ignored issues
–
show
|
|||
27 | expect(mqttConfig.port).to.not.be.undefined |
||
0 ignored issues
–
show
|
|||
28 | expect(mqttConfig.qos).to.not.be.undefined |
||
0 ignored issues
–
show
|
|||
29 | done() |
||
30 | }) |
||
31 | it('has the username as string', (done) => { |
||
32 | expect(mqttConfig.username).to.have.string('test') |
||
33 | done() |
||
34 | }) |
||
35 | it('has the password as string', (done) => { |
||
36 | expect(mqttConfig.password).to.have.string('test') |
||
37 | done() |
||
38 | }) |
||
39 | it('has the port as integer', (done) => { |
||
40 | expect(mqttConfig.port).to.be.integer() |
||
41 | done() |
||
42 | }) |
||
43 | it('has the qos as integer', (done) => { |
||
44 | expect(mqttConfig.qos).to.be.integer() |
||
45 | done() |
||
46 | }) |
||
47 | }) |
||
48 | |||
49 | }) |
||
50 |