diff --git a/tests/DPT013.test.ts b/tests/DPT013.test.ts index 98edaee..e32d2e4 100644 --- a/tests/DPT013.test.ts +++ b/tests/DPT013.test.ts @@ -42,6 +42,20 @@ describe("Test DPT013", (): void => { expect(compareBuffers(dpt.encoder(value), buffer)).is.true; }); + it("encode not integer", async function () { + var testFunction = function () { + const value = dpt.encoder(Math.PI) + } + expect(testFunction).to.throw(InvalidValueError); + }); + + it("encode out of range", async function () { + var testFunction = function () { + const value = dpt.encoder(-Math.pow(2, 31) - 1) + } + expect(testFunction).to.throw(InvalidValueError); + }); + it("encode undefined", async function () { var testFunction = function () { const value = dpt.encoder(undefined)