forked from BiancoRoyal/node-bacstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.spec.js
More file actions
38 lines (36 loc) · 1.08 KB
/
Copy pathclient.spec.js
File metadata and controls
38 lines (36 loc) · 1.08 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
'use strict';
const expect = require('chai').expect;
const utils = require('./utils');
const baEnum = require('../../lib/enum');
const client = require('../../lib/client');
describe('bacnet - client', () => {
it('should successfuly encode a bitstring > 32 bits', () => {
const result = client.createBitstring([
baEnum.ServicesSupported.CONFIRMED_COV_NOTIFICATION,
baEnum.ServicesSupported.READ_PROPERTY,
baEnum.ServicesSupported.WHO_IS,
]);
expect(result).to.deep.equal({
value: [2, 16, 0, 0, 4],
bitsUsed: 35,
});
});
it('should successfuly encode a bitstring < 8 bits', () => {
const result = client.createBitstring([
baEnum.ServicesSupported.GET_ALARM_SUMMARY,
]);
expect(result).to.deep.equal({
value: [8],
bitsUsed: 4,
});
});
it('should successfuly encode a bitstring of only one bit', () => {
const result = client.createBitstring([
baEnum.ServicesSupported.ACKNOWLEDGE_ALARM,
]);
expect(result).to.deep.equal({
value: [1],
bitsUsed: 1,
});
});
});