import { CommandClasses } from "@zwave-js/core" ; import type { Driver } from "../driver/Driver" ; import { createEmptyMockDriver } from "../test/mocks" ; import { NoOperationCC } from "./NoOperationCC" ; const fakeDriver = createEmptyMockDriver ( ) as unknown as Driver ; function buildCCBuffer ( payload ) { return Buffer . concat ( [ Buffer . from ( [ CommandClasses [ "No Operation" ] , ] ) , payload , ] ) ; } describe ( "lib/commandclass/NoOperationCC => " , ( ) => { it ( "the CC should serialize correctly" , ( ) => { const cc = new NoOperationCC ( fakeDriver , { nodeId : 1 } ) ; const expected = buildCCBuffer ( Buffer . from ( [ ] ) ) ; expect ( cc . serialize ( ) ) . toEqual ( expected ) ; } ) ; it ( "the CC should be deserialized correctly" , ( ) => { const ccData = buildCCBuffer ( Buffer . from ( [ ] ) ) ; void new NoOperationCC ( fakeDriver , { nodeId : 2 , data : ccData } ) ; } ) ; } ) ;