UNPKG

dlms-protocol

Version:

DLMS Protocol parser for JavaScript

29 lines (24 loc) 959 B
import None from "../src/typesDLMS/None"; import DlmsDataType from "../src/enum/DlmsDataType"; describe("None class", () => { test("should initialize with default values", () => { const none = new None(); expect(none.tag).toBe(DlmsDataType.NONE); expect(none.totalBytes).toBe(1); // rawValue.length expect(none.rawValue).toEqual([0]); expect(none.bodyBytes).toEqual([0]); expect(none.value).toBe(0); }); test("should return the correct standard length", () => { const none = new None(); expect(none.getStandardLength()).toBe(1); }); test("should return the correct value with getValue()", () => { const none = new None(); expect(none.getValue()).toBe(0); }); test("should throw an error if insertData() is called", () => { const none = new None(); expect(() => none.insertData([1])).toThrow("Method not implemented."); }); });