Files
de.captica.nodered.node.sys…/test/systacomfort2.js

35 lines
1.0 KiB
JavaScript

/**
* 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')
})
})
})