From df8c52f1120cf61e7d47752a6842dc885cf3a6d2 Mon Sep 17 00:00:00 2001 From: Laur Ivan Date: Sun, 13 Mar 2022 01:59:35 +0100 Subject: [PATCH] DPT13 100% coverage. --- tests/DPT013.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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)