forked from fh1ch/node-bacstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1-add-cov-notification' into 'master'
Resolve "add cov notification" Closes fh1ch#1 See merge request SystemX/testing/node-bacstack!1
- Loading branch information
Showing
3 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
const baEnum = require('../../lib/enum'); | ||
|
||
describe('bacstack - confirmedCOVNotification integration', () => { | ||
it('should return a timeout error if no device is available', (next) => { | ||
const client = new utils.bacnetClient({apduTimeout: 200}); | ||
client.confirmedCOVNotification( | ||
'127.0.0.1', 3, 433, {type: 2, instance: 122}, 120, | ||
[ | ||
{ | ||
property: {id: 85}, | ||
value: [{type: baEnum.ApplicationTags.REAL, value: 12.3}] | ||
}, | ||
{ | ||
property: {id: 111}, | ||
value: [{type: baEnum.ApplicationTags.BIT_STRING, value: 0xFFFF}] | ||
} | ||
], | ||
(err, value) => { | ||
expect(err.message).to.eql('ERR_TIMEOUT'); | ||
expect(value).to.eql(undefined); | ||
client.close(); | ||
next(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
const expect = require('chai').expect; | ||
const utils = require('./utils'); | ||
const baEnum = require('../../lib/enum'); | ||
|
||
describe('bacstack - unconfirmedCOVNotification integration', () => { | ||
it('should correctly send a telegram', () => { | ||
const client = new utils.bacnetClient({apduTimeout: 200}); | ||
client.unconfirmedCOVNotification( | ||
'127.0.0.1', 3, 433, {type: 2, instance: 122}, 120, [ | ||
{ | ||
property: {id: 85}, | ||
value: [{type: baEnum.ApplicationTags.REAL, value: 12.3}] | ||
}, | ||
{ | ||
property: {id: 111}, | ||
value: | ||
[{type: baEnum.ApplicationTags.BIT_STRING, value: 0xFFFF}] | ||
} | ||
]); | ||
client.close(); | ||
}); | ||
}); |