config.test.js
1.77 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
import expect from 'expect.js';
import muk from 'muk';
import info from '../../src/lib/interface';
import Config from '../../src/lib/directive/config';
describe('config.js', function() {
describe('init', function() {
it('expect prower filter stayTime frequency exits', function() {
let config = new Config();
expect(config.reproc[info.setPower.input]).to.be.eql(config.prePower);
expect(config.reproc[info.setFilter.input]).to.be.eql(config.preFilter);
expect(config.reproc[info.setAntStayTime.input]).to.be.eql(config.preStayTime);
expect(config.reproc[info.setFrequency.input]).to.be.eql(config.preFrequency);
});
});
describe('prePower', function() {
it('input [15, 15, 0, 0] expect F30F0F0000', function() {
let config = new Config();
expect(config.prePower([15, 15, 0, 0])).to.be(info.setPower.input + '0F0F0000');
});
});
describe('preFilter', function() {
it('input {on:"1",rssi:-27.5} epxect F701FEED00',
function() {
let config = new Config();
expect(config.preFilter({
on: '1',
rssi: -27.5
})).to.be(info.setFilter.input + '01FEED00');
});
});
describe('preStayTime', function() {
it('input 100 expect CA00000064', function() {
let config = new Config();
expect(config.preStayTime(100)).to.be(info.setAntStayTime.input + '00000064');
});
});
describe('preFrequency', function() {
it('input 10 expect BF0A000000', function() {
let config = new Config();
expect(config.preFrequency(10)).to.be(info.setFrequency.input + '0A000000')
});
});
});