CAPAUT-254 Reorg files, add tests

This commit is contained in:
2022-07-27 23:52:55 +02:00
parent 909d4876b7
commit db4e309439
6 changed files with 1742 additions and 124 deletions

35
test/systacomfort2.js Normal file
View 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')
})
})
})