DPT13 100% coverage.

This commit is contained in:
Laur Ivan 2022-03-13 01:59:35 +01:00
parent dcb3d2bea9
commit df8c52f112

View File

@ -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)