tests added
This commit is contained in:
parent
e857b7baa7
commit
49a6a46052
@ -139,6 +139,9 @@ describe('The Meterbus Library', () => {
|
|||||||
expect((telegram.frame as MeterbusLibFrames.ControlFrame).ciField).to.equal(3)
|
expect((telegram.frame as MeterbusLibFrames.ControlFrame).ciField).to.equal(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
describe('The Meterbus Longframe Library', () => {
|
describe('The Meterbus Longframe Library', () => {
|
||||||
let telegram : MeterbusLib.Telegram
|
let telegram : MeterbusLib.Telegram
|
||||||
|
|
||||||
@ -180,5 +183,3 @@ describe('The Meterbus Library', () => {
|
|||||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).getJSON()).to.equal(json_1phase_electric)
|
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).getJSON()).to.equal(json_1phase_electric)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
|
@ -1,6 +1,8 @@
|
|||||||
import {MeterbusLibExceptions} from './exceptions'
|
import {MeterbusLibExceptions} from './exceptions'
|
||||||
import {MeterbusLibFrames} from './simpleframes'
|
import {MeterbusLibFrames} from './simpleframes'
|
||||||
import {MeterbusLibLongFrame} from './longframe'
|
import {MeterbusLibLongFrame} from './longframe'
|
||||||
|
import {MeterbusLibUtils} from './utils'
|
||||||
|
|
||||||
|
|
||||||
export namespace MeterbusLib {
|
export namespace MeterbusLib {
|
||||||
|
|
||||||
|
@ -26,3 +26,26 @@ describe('The Meterbus Library Utils', () => {
|
|||||||
expect(MeterbusLibUtils.manufCode([0x2e, 0x19])).to.equal("FIN")
|
expect(MeterbusLibUtils.manufCode([0x2e, 0x19])).to.equal("FIN")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('The jsonPrepare function in the Meterbus Library Utils', () => {
|
||||||
|
it('should forward regular properties of an object', () => {
|
||||||
|
let objIn = {'a': 1, 'b':2}
|
||||||
|
let objOut = objIn
|
||||||
|
expect(MeterbusLibUtils.jsonPrepaper(objIn, [])).to.deep.equal(objOut)
|
||||||
|
})
|
||||||
|
it('should hide properties in the hide list', () => {
|
||||||
|
let objIn = {'a': 1, 'b':2}
|
||||||
|
let objOut = {'a': 1}
|
||||||
|
expect(MeterbusLibUtils.jsonPrepaper(objIn, ['b'])).to.deep.equal(objOut)
|
||||||
|
})
|
||||||
|
it('should hide properties beginning with two underscores', () => {
|
||||||
|
let objIn = {'a': 1, '__b':2}
|
||||||
|
let objOut = {'a': 1}
|
||||||
|
expect(MeterbusLibUtils.jsonPrepaper(objIn, [])).to.deep.equal(objOut)
|
||||||
|
})
|
||||||
|
it('should remove one leading underscore from property names', () => {
|
||||||
|
let objIn = {'_a': 1, 'b':2}
|
||||||
|
let objOut = {'a': 1, 'b':2}
|
||||||
|
expect(MeterbusLibUtils.jsonPrepaper(objIn, [])).to.deep.equal(objOut)
|
||||||
|
})
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user