CAPAUT-254 Reorg files, add tests
This commit is contained in:
35
test/systacomfort2.js
Normal file
35
test/systacomfort2.js
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
/**
|
||||
* SystaComfort II node test
|
||||
*
|
||||
*/
|
||||
var assert = require('assert')
|
||||
var systaComfort2Node = require('../systacomfort2/systacomfort2')
|
||||
var dataParser = require('../systacomfort2/dataparser')
|
||||
|
||||
const RED_MOCK = {
|
||||
nodes: {
|
||||
registerType: function(name, obj) {
|
||||
it('should be registered on node-RED as a new node type', () => {
|
||||
assert.equal('systacomfort2', name)
|
||||
assert.ok(obj)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
describe('SystaComfort2 - Node-RED node', function() {
|
||||
// Check node registration first
|
||||
systaComfort2Node(RED_MOCK)
|
||||
})
|
||||
|
||||
describe('SystaComfort2 - Data Parser', function() {
|
||||
describe('#createMACPart()', function() {
|
||||
it('should convert a byte into string and pad with a leading "0"', function() {
|
||||
assert.equal(dataParser.createMACPart(15), '0f')
|
||||
})
|
||||
it('should convert a byte into as string and NOT pad with a leading "0"', function() {
|
||||
assert.equal(dataParser.createMACPart(255), 'ff')
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user