diff --git a/packages/zwave-js/src/lib/driver/Transaction.test.ts b/packages/zwave-js/src/lib/driver/Transaction.test.ts index fa2081225a7e..0c8b418767c1 100644 --- a/packages/zwave-js/src/lib/driver/Transaction.test.ts +++ b/packages/zwave-js/src/lib/driver/Transaction.test.ts @@ -164,12 +164,12 @@ test("NodeQuery comparisons should prioritize listening nodes", (t) => { ) { const driver = driverMock as any as Driver; const msg = nodeId != undefined - ? new SendDataRequest(driver, { + ? new SendDataRequest({ command: new NoOperationCC({ nodeId, }), }) - : new GetControllerVersionRequest(driver); + : new GetControllerVersionRequest(); const ret = createDummyTransaction(driverMock, { priority, message: msg, @@ -273,7 +273,7 @@ test("Messages in the wakeup queue should be preferred over lesser priorities on function createTransaction(nodeId: number, priority: MessagePriority) { const driver = driverMock as any as Driver; - const msg = new SendDataRequest(driver, { + const msg = new SendDataRequest({ command: new NoOperationCC({ nodeId }), }); const ret = createDummyTransaction(driverMock, { @@ -380,14 +380,14 @@ test("Controller message should be preferred over messages for sleeping nodes", return ret; } - const msgForSleepingNode = new SendDataRequest(driverMock, { - command: new NoOperationCC(driverMock, { nodeId: 2 }), + const msgForSleepingNode = new SendDataRequest({ + command: new NoOperationCC({ nodeId: 2 }), }); const tSleepingNode = createTransaction( msgForSleepingNode, MessagePriority.WakeUp, ); - const msgForController = new RemoveFailedNodeRequest(driverMock, { + const msgForController = new RemoveFailedNodeRequest({ failedNodeId: 3, }); const tController = createTransaction(msgForController); diff --git a/packages/zwave-js/src/lib/log/Driver.test.ts b/packages/zwave-js/src/lib/log/Driver.test.ts index 589d00921085..849c597323b1 100644 --- a/packages/zwave-js/src/lib/log/Driver.test.ts +++ b/packages/zwave-js/src/lib/log/Driver.test.ts @@ -88,7 +88,7 @@ function createMessage( driver: Driver, options: Partial, ) { - return new Message(driver, { + return new Message({ type: options.type || MessageType.Request, functionType: options.functionType || (0x00 as any), }); diff --git a/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.test.ts b/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.test.ts index af6a095402db..cfeaed9dc9f5 100644 --- a/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.test.ts +++ b/packages/zwave-js/src/lib/serialapi/application/BridgeApplicationCommandRequest.test.ts @@ -10,7 +10,7 @@ test("BridgeApplicationCommandRequest can be parsed without RSSI", async (t) => // Repro for https://github.com/zwave-js/node-zwave-js/issues/4335 t.notThrows(() => - Message.from(host, { + Message.from({ data: Buffer.from( "011200a80001020a320221340000000000000069", "hex", diff --git a/packages/zwave-js/src/lib/serialapi/capability/SerialAPISetupMessages.test.ts b/packages/zwave-js/src/lib/serialapi/capability/SerialAPISetupMessages.test.ts index 2a20792032fc..f013c4fc354e 100644 --- a/packages/zwave-js/src/lib/serialapi/capability/SerialAPISetupMessages.test.ts +++ b/packages/zwave-js/src/lib/serialapi/capability/SerialAPISetupMessages.test.ts @@ -11,7 +11,7 @@ test("GetSupportedCommandsResponse with extended bitmask parses correctly (pre-7 "hex", ); - const msg = Message.from(host, { + const msg = Message.from({ data, sdkVersion: "7.19.0", ctx: {} as any, @@ -32,7 +32,7 @@ test("GetSupportedCommandsResponse with extended bitmask parses correctly (post- "hex", ); - const msg = Message.from(host, { + const msg = Message.from({ data, sdkVersion: "7.19.1", ctx: {} as any, diff --git a/packages/zwave-js/src/lib/test/cc/CRC16CC.test.ts b/packages/zwave-js/src/lib/test/cc/CRC16CC.test.ts index 75904afa7c30..e7b47b43c866 100644 --- a/packages/zwave-js/src/lib/test/cc/CRC16CC.test.ts +++ b/packages/zwave-js/src/lib/test/cc/CRC16CC.test.ts @@ -17,14 +17,14 @@ test("should be detected as an encapsulating CC", (t) => { nodeId: 3, targetValue: 89, }); - const crc16 = CRC16CC.encapsulate(host, basicCCSet); + const crc16 = CRC16CC.encapsulate(basicCCSet); t.true(isEncapsulatingCommandClass(crc16)); }); test("should match the specs", (t) => { // SDS13783 contains the following sample encapsulated command: const basicCCGet = new BasicCCGet({ nodeId: 1 }); - const crc16 = CRC16CC.encapsulate(host, basicCCGet); + const crc16 = CRC16CC.encapsulate(basicCCGet); const serialized = crc16.serialize({} as any); const expected = Buffer.from("560120024d26", "hex"); t.deepEqual(serialized, expected); @@ -35,7 +35,7 @@ test("serialization and deserialization should be compatible", (t) => { nodeId: 3, targetValue: 89, }); - const crc16 = CRC16CC.encapsulate(host, basicCCSet); + const crc16 = CRC16CC.encapsulate(basicCCSet); t.is(crc16.nodeId, basicCCSet.nodeId); t.is(crc16.encapsulated, basicCCSet); const serialized = crc16.serialize({} as any); @@ -58,7 +58,7 @@ test("deserializing a CC with a wrong checksum should result in an invalid CC", nodeId: 3, targetValue: 89, }); - const crc16 = CRC16CC.encapsulate(host, basicCCSet); + const crc16 = CRC16CC.encapsulate(basicCCSet); t.is(crc16.nodeId, basicCCSet.nodeId); t.is(crc16.encapsulated, basicCCSet); const serialized = crc16.serialize({} as any); diff --git a/packages/zwave-js/src/lib/test/cc/CommandClass.nonImplemented.test.ts b/packages/zwave-js/src/lib/test/cc/CommandClass.nonImplemented.test.ts index 6eabd644a761..40ba6a78e7fc 100644 --- a/packages/zwave-js/src/lib/test/cc/CommandClass.nonImplemented.test.ts +++ b/packages/zwave-js/src/lib/test/cc/CommandClass.nonImplemented.test.ts @@ -9,7 +9,7 @@ integrationTest( async testBody(t, driver, node, mockController, mockNode) { // This CC will never be supported (certification requirement) - const cc = new CommandClass(driver, { + const cc = new CommandClass({ nodeId: 2, ccId: CommandClasses["Anti-Theft"], ccCommand: 0x02, diff --git a/packages/zwave-js/src/lib/test/cc/MultiChannelCC.test.ts b/packages/zwave-js/src/lib/test/cc/MultiChannelCC.test.ts index 71fe1285885d..837d4ce6fd49 100644 --- a/packages/zwave-js/src/lib/test/cc/MultiChannelCC.test.ts +++ b/packages/zwave-js/src/lib/test/cc/MultiChannelCC.test.ts @@ -35,7 +35,7 @@ test("is an encapsulating CommandClass", (t) => { nodeId: 1, targetValue: 50, }); - cc = MultiChannelCC.encapsulate(host, cc); + cc = MultiChannelCC.encapsulate(cc); t.true(isEncapsulatingCommandClass(cc)); }); @@ -85,7 +85,7 @@ test("the CommandEncapsulation command should serialize correctly", (t) => { targetValue: 5, endpoint: 7, }); - cc = MultiChannelCC.encapsulate(host, cc); + cc = MultiChannelCC.encapsulate(cc); const expected = buildCCBuffer( Buffer.from([ MultiChannelCommand.CommandEncapsulation, // CC Command @@ -189,7 +189,6 @@ test("deserializing an unsupported command should return an unspecified version test("MultiChannelCC/BasicCCGet should expect a response", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new BasicCCGet({ nodeId: 2, endpoint: 2, @@ -200,7 +199,6 @@ test("MultiChannelCC/BasicCCGet should expect a response", (t) => { test("MultiChannelCC/BasicCCGet (multicast) should expect NO response", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new BasicCCGet({ nodeId: 2, endpoint: 2, @@ -213,7 +211,6 @@ test("MultiChannelCC/BasicCCGet (multicast) should expect NO response", (t) => { test("MultiChannelCC/BasicCCSet should expect NO response", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new BasicCCSet({ nodeId: 2, endpoint: 2, @@ -225,14 +222,12 @@ test("MultiChannelCC/BasicCCSet should expect NO response", (t) => { test("MultiChannelCC/BasicCCGet => MultiChannelCC/BasicCCReport = expected", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new BasicCCGet({ nodeId: 2, endpoint: 2, }), ); const ccResponse = MultiChannelCC.encapsulate( - host, new BasicCCReport({ nodeId: ccRequest.nodeId, currentValue: 7, @@ -245,14 +240,12 @@ test("MultiChannelCC/BasicCCGet => MultiChannelCC/BasicCCReport = expected", (t) test("MultiChannelCC/BasicCCGet => MultiChannelCC/BasicCCGet = unexpected", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new BasicCCGet({ nodeId: 2, endpoint: 2, }), ); const ccResponse = MultiChannelCC.encapsulate( - host, new BasicCCGet({ nodeId: ccRequest.nodeId, endpoint: 2, @@ -265,13 +258,12 @@ test("MultiChannelCC/BasicCCGet => MultiChannelCC/BasicCCGet = unexpected", (t) test("MultiChannelCC/BasicCCGet => MultiCommandCC/BasicCCReport = unexpected", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new BasicCCGet({ nodeId: 2, endpoint: 2, }), ); - const ccResponse = MultiCommandCC.encapsulate(host, [ + const ccResponse = MultiCommandCC.encapsulate([ new BasicCCReport({ nodeId: ccRequest.nodeId, currentValue: 7, diff --git a/packages/zwave-js/src/lib/test/cc/MultiCommandCC.test.ts b/packages/zwave-js/src/lib/test/cc/MultiCommandCC.test.ts index 5d7fdf794583..ec558c7d4099 100644 --- a/packages/zwave-js/src/lib/test/cc/MultiCommandCC.test.ts +++ b/packages/zwave-js/src/lib/test/cc/MultiCommandCC.test.ts @@ -14,6 +14,6 @@ test("is a multi-encapsulating CommandClass", (t) => { nodeId: 1, targetValue: 50, }); - cc = MultiCommandCC.encapsulate(host, [cc]); + cc = MultiCommandCC.encapsulate([cc]); t.true(isMultiEncapsulatingCommandClass(cc)); }); diff --git a/packages/zwave-js/src/lib/test/cc/SupervisionCC.test.ts b/packages/zwave-js/src/lib/test/cc/SupervisionCC.test.ts index b382c7c9e1ce..99d8cb0ad2e6 100644 --- a/packages/zwave-js/src/lib/test/cc/SupervisionCC.test.ts +++ b/packages/zwave-js/src/lib/test/cc/SupervisionCC.test.ts @@ -7,7 +7,6 @@ const host = createTestingHost(); test("SupervisionCCGet should expect a response", (t) => { const ccRequest = SupervisionCC.encapsulate( - host, new BasicCCSet({ nodeId: 2, targetValue: 5, @@ -18,7 +17,6 @@ test("SupervisionCCGet should expect a response", (t) => { test("SupervisionCC/BasicCCSet => SupervisionCCReport (correct session ID) = expected", (t) => { const ccRequest = SupervisionCC.encapsulate( - host, new BasicCCSet({ nodeId: 2, targetValue: 5, @@ -36,7 +34,6 @@ test("SupervisionCC/BasicCCSet => SupervisionCCReport (correct session ID) = exp test("SupervisionCC/BasicCCSet => SupervisionCCReport (wrong session ID) = unexpected", (t) => { const ccRequest = SupervisionCC.encapsulate( - host, new BasicCCSet({ nodeId: 2, targetValue: 5, diff --git a/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts b/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts index 8fb60a603854..9e86bdd31298 100644 --- a/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts +++ b/packages/zwave-js/src/lib/test/cc/WakeUpCC.test.ts @@ -20,7 +20,6 @@ test("WakeUpCCNoMoreInformation should expect no response", (t) => { test("MultiChannelCC/WakeUpCCNoMoreInformation should expect NO response", (t) => { const ccRequest = MultiChannelCC.encapsulate( - host, new WakeUpCCNoMoreInformation({ nodeId: 2, endpoint: 2, @@ -42,7 +41,6 @@ test("SecurityCC/WakeUpCCNoMoreInformation should expect NO response", (t) => { }; const ccRequest = SecurityCC.encapsulate( - host, host.ownNodeId, securityManager as any, new WakeUpCCNoMoreInformation({ diff --git a/packages/zwave-js/src/lib/test/compliance/zwavePlusInfoResponse.test.ts b/packages/zwave-js/src/lib/test/compliance/zwavePlusInfoResponse.test.ts index 5ec609b59f43..d1cd190b1ad3 100644 --- a/packages/zwave-js/src/lib/test/compliance/zwavePlusInfoResponse.test.ts +++ b/packages/zwave-js/src/lib/test/compliance/zwavePlusInfoResponse.test.ts @@ -27,7 +27,7 @@ integrationTest("Response to Z-Wave Plus Info Get", { }, testBody: async (t, driver, node, mockController, mockNode) => { - const zwpRequest = new ZWavePlusCCGet(mockController.host, { + const zwpRequest = new ZWavePlusCCGet({ nodeId: mockNode.id, }); await mockNode.sendToController( diff --git a/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts b/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts index 7506bfe66368..b63ee216c405 100644 --- a/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts +++ b/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts @@ -51,7 +51,7 @@ test.afterEach.always(async (t) => { test.serial("returns true when a non-partial CC is received", (t) => { const { driver } = t.context; const cc = new BasicCCSet({ nodeId: 2, targetValue: 50 }); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.true(driver["assemblePartialCCs"](msg)); @@ -75,7 +75,7 @@ test.serial( ]), context: {} as any, }); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.true(driver["assemblePartialCCs"](msg)); @@ -100,7 +100,7 @@ test.serial( ]), context: {} as any, }); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.false(driver["assemblePartialCCs"](msg)); @@ -139,12 +139,12 @@ test.serial( ]), context: {} as any, }); - const msg1 = new ApplicationCommandRequest(driver, { + const msg1 = new ApplicationCommandRequest({ command: cc1, }); t.false(driver["assemblePartialCCs"](msg1)); - const msg2 = new ApplicationCommandRequest(driver, { + const msg2 = new ApplicationCommandRequest({ command: cc2, }); t.true(driver["assemblePartialCCs"](msg2)); @@ -164,7 +164,7 @@ test.serial("does not crash when receiving a Multi Command CC", (t) => { nodeId: 2, encapsulated: [cc1, cc2], }); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.true(driver["assemblePartialCCs"](msg)); @@ -181,7 +181,7 @@ test.serial("supports nested partial/non-partial CCs", (t) => { }); cc.encapsulated = undefined as any; cc["decryptedCCBytes"] = cc1.serialize({} as any); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.true(driver["assemblePartialCCs"](msg)); @@ -206,7 +206,7 @@ test.serial("supports nested partial/partial CCs (part 1)", (t) => { 2, 3, ]); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.false(driver["assemblePartialCCs"](msg)); @@ -231,7 +231,7 @@ test.serial("supports nested partial/partial CCs (part 2)", (t) => { 2, 3, ]); - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.true(driver["assemblePartialCCs"](msg)); @@ -261,7 +261,7 @@ test.serial( ZWaveErrorCodes.Deserialization_NotImplemented, ); }; - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.false(driver["assemblePartialCCs"](msg)); @@ -292,7 +292,7 @@ test.serial( ZWaveErrorCodes.CC_NotImplemented, ); }; - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.false(driver["assemblePartialCCs"](msg)); @@ -323,7 +323,7 @@ test.serial( ZWaveErrorCodes.PacketFormat_InvalidPayload, ); }; - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.false(driver["assemblePartialCCs"](msg)); @@ -349,7 +349,7 @@ test.serial("passes other errors during merging through", (t) => { cc.mergePartialCCs = () => { throw new ZWaveError("invalid", ZWaveErrorCodes.Argument_Invalid); }; - const msg = new ApplicationCommandRequest(driver, { + const msg = new ApplicationCommandRequest({ command: cc, }); t.throws(() => driver["assemblePartialCCs"](msg), { message: /invalid/ }); diff --git a/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts b/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts index d8d6e79bf0e8..b7d5311af2bd 100644 --- a/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts +++ b/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts @@ -43,7 +43,7 @@ test.afterEach.always(async (t) => { test("should compute the correct net payload sizes", (t) => { const { driver } = t.context; - const testMsg1 = new SendDataRequest(driver, { + const testMsg1 = new SendDataRequest({ command: new SecurityCCCommandEncapsulation({ nodeId: 2, ownNodeId: driver.ownNodeId, @@ -60,7 +60,7 @@ test("should compute the correct net payload sizes", (t) => { destination: 1, encapsulated: {} as any, }); - const testMsg2 = new SendDataRequest(driver, { + const testMsg2 = new SendDataRequest({ command: new SecurityCCCommandEncapsulation({ nodeId: 2, ownNodeId: driver.ownNodeId, diff --git a/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts b/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts index 2612e9463eae..994574552cbe 100644 --- a/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts +++ b/packages/zwave-js/src/lib/test/driver/nodeAsleepMessageOrder.test.ts @@ -171,12 +171,9 @@ integrationTest( // Node 10 wakes up mockNode10.autoAckControllerFrames = true; - const cc: CommandClass = new WakeUpCCWakeUpNotification( - mockNode10.host, - { - nodeId: mockController.ownNodeId, - }, - ); + const cc: CommandClass = new WakeUpCCWakeUpNotification({ + nodeId: mockController.ownNodeId, + }); mockNode10.sendToController(createMockZWaveRequestFrame(cc, { ackRequested: false, })); @@ -306,12 +303,9 @@ integrationTest( // Node 10 wakes up mockNode10.autoAckControllerFrames = true; - const cc: CommandClass = new WakeUpCCWakeUpNotification( - mockNode10.host, - { - nodeId: mockController.ownNodeId, - }, - ); + const cc: CommandClass = new WakeUpCCWakeUpNotification({ + nodeId: mockController.ownNodeId, + }); mockNode10.sendToController(createMockZWaveRequestFrame(cc, { ackRequested: false, })); diff --git a/packages/zwave-js/src/lib/test/driver/nodeUpdateBeforeCallback.test.ts b/packages/zwave-js/src/lib/test/driver/nodeUpdateBeforeCallback.test.ts index 62db5673455f..a76f267286c0 100644 --- a/packages/zwave-js/src/lib/test/driver/nodeUpdateBeforeCallback.test.ts +++ b/packages/zwave-js/src/lib/test/driver/nodeUpdateBeforeCallback.test.ts @@ -30,7 +30,7 @@ integrationTest( const respondToBasicGetWithDelayedAck: MockNodeBehavior = { async handleCC(controller, self, receivedCC) { if (receivedCC instanceof BasicCCGet) { - const cc = new BasicCCReport(controller.host, { + const cc = new BasicCCReport({ nodeId: self.id, currentValue: 55, }); diff --git a/packages/zwave-js/src/lib/test/driver/receiveMessages.test.ts b/packages/zwave-js/src/lib/test/driver/receiveMessages.test.ts index 866dd57275c1..d5c1d155ad4c 100644 --- a/packages/zwave-js/src/lib/test/driver/receiveMessages.test.ts +++ b/packages/zwave-js/src/lib/test/driver/receiveMessages.test.ts @@ -36,7 +36,7 @@ test.serial( "should not crash if a message is received that cannot be deserialized", async (t) => { const { driver, controller } = t.context; - const req = new ApplicationCommandRequest(driver, { + const req = new ApplicationCommandRequest({ command: new WakeUpCCIntervalSet({ nodeId: 1, controllerNodeId: 2, diff --git a/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts b/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts index 6d64a8924894..8e5cde068156 100644 --- a/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts +++ b/packages/zwave-js/src/lib/test/driver/s0Encapsulation.test.ts @@ -94,7 +94,6 @@ integrationTest("Communication via Security S0 works", { controlledCCs: [], }); const cc = SecurityCC.encapsulate( - self.host, self.id, self.securityManagers.securityManager!, response, @@ -147,7 +146,6 @@ integrationTest("Communication via Security S0 works", { currentValue: ++queryCount, }); const cc = SecurityCC.encapsulate( - self.host, self.id, self.securityManagers.securityManager!, response, diff --git a/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts b/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts index 81257b1e38cb..800d14e5119e 100644 --- a/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts +++ b/packages/zwave-js/src/lib/test/driver/s0EncapsulationTwoNodes.test.ts @@ -119,7 +119,6 @@ integrationTest( controlledCCs: [], }); const cc = SecurityCC.encapsulate( - self.host, self.id, self.securityManagers.securityManager!, response, @@ -182,7 +181,6 @@ integrationTest( currentValue: queryCount, }); const cc = SecurityCC.encapsulate( - self.host, self.id, self.securityManagers.securityManager!, response, @@ -234,7 +232,7 @@ integrationTest( await wait(150); // Now send a Nonce Get from node 3, which must be answered immediately - const nonceGet = new SecurityCCNonceGet(mockNode3.host, { + const nonceGet = new SecurityCCNonceGet({ nodeId: mockController.ownNodeId, }); await mockNode3.sendToController( diff --git a/packages/zwave-js/src/lib/test/driver/sendDataMissingCallbackAbort.test.ts b/packages/zwave-js/src/lib/test/driver/sendDataMissingCallbackAbort.test.ts index 1ffdf8940737..b9de6e4f3b09 100644 --- a/packages/zwave-js/src/lib/test/driver/sendDataMissingCallbackAbort.test.ts +++ b/packages/zwave-js/src/lib/test/driver/sendDataMissingCallbackAbort.test.ts @@ -803,7 +803,7 @@ integrationTest( MockControllerCommunicationState.Idle, ); - const ret = new SerialAPIStartedRequest(mockController.host, { + const ret = new SerialAPIStartedRequest({ wakeUpReason: SerialAPIWakeUpReason.WatchdogReset, watchdogEnabled: true, isListening: true, diff --git a/packages/zwave-js/src/lib/test/driver/supervisionRepeatedReport.test.ts b/packages/zwave-js/src/lib/test/driver/supervisionRepeatedReport.test.ts index 3e212e4ec7b5..1883f8109adc 100644 --- a/packages/zwave-js/src/lib/test/driver/supervisionRepeatedReport.test.ts +++ b/packages/zwave-js/src/lib/test/driver/supervisionRepeatedReport.test.ts @@ -42,7 +42,7 @@ integrationTest( const respondToSupervisionGet: MockNodeBehavior = { handleCC(controller, self, receivedCC) { if (receivedCC instanceof SupervisionCCGet) { - const cc = new SupervisionCCReport(controller.host, { + const cc = new SupervisionCCReport({ nodeId: self.id, sessionId: receivedCC.sessionId, moreUpdatesFollow: false, diff --git a/packages/zwave-js/src/lib/test/mocks.ts b/packages/zwave-js/src/lib/test/mocks.ts index b407a372d5d1..9e15f4923e3c 100644 --- a/packages/zwave-js/src/lib/test/mocks.ts +++ b/packages/zwave-js/src/lib/test/mocks.ts @@ -27,7 +27,6 @@ import { priority, } from "@zwave-js/serial"; import sinon from "sinon"; -import type { Driver } from "../driver/Driver"; import type { ZWaveNode } from "../node/Node"; import * as nodeUtils from "../node/utils"; import { SendDataRequest } from "../serialapi/transport/SendDataMessages"; @@ -171,9 +170,7 @@ export function createEmptyMockDriver() { }, }; ret.sendCommand.callsFake(async (command, options) => { - const msg = new SendDataRequest(ret as unknown as Driver, { - command, - }); + const msg = new SendDataRequest({ command }); const resp = await ret.sendMessage(msg, options); return resp?.command; }); diff --git a/packages/zwave-js/src/lib/test/node/Node.handleCommand.test.ts b/packages/zwave-js/src/lib/test/node/Node.handleCommand.test.ts index 4f02cb584b6a..a356fdc2d349 100644 --- a/packages/zwave-js/src/lib/test/node/Node.handleCommand.test.ts +++ b/packages/zwave-js/src/lib/test/node/Node.handleCommand.test.ts @@ -64,18 +64,15 @@ test.serial( } as any; // Handle a command for the root endpoint - const command = new BinarySwitchCCReport( - fakeDriver as unknown as Driver, - { - nodeId: 2, - data: Buffer.from([ - CommandClasses["Binary Switch"], - BinarySwitchCommand.Report, - 0xff, - ]), - context: {} as any, - }, - ); + const command = new BinarySwitchCCReport({ + nodeId: 2, + data: Buffer.from([ + CommandClasses["Binary Switch"], + BinarySwitchCommand.Report, + 0xff, + ]), + context: {} as any, + }); await node.handleCommand(command); t.true( @@ -120,14 +117,11 @@ test.serial( Buffer.alloc(12, 0xff), ]); - const command = new EntryControlCCNotification( - fakeDriver as unknown as Driver, - { - nodeId: node.id, - data: buf, - context: {} as any, - }, - ); + const command = new EntryControlCCNotification({ + nodeId: node.id, + data: buf, + context: {} as any, + }); await node.handleCommand(command); diff --git a/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts b/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts index 8e7a1dba50e4..f1730da94fb9 100644 --- a/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts +++ b/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts @@ -64,21 +64,17 @@ integrationTest( }, testBody: async (t, driver, node, mockController, mockNode) => { - const nif = new ApplicationUpdateRequestNodeInfoReceived( - mockController.host, - { - nodeInformation: { - nodeId: node.id, - basicDeviceClass: - mockNode.capabilities.basicDeviceClass, - genericDeviceClass: - mockNode.capabilities.genericDeviceClass, - specificDeviceClass: - mockNode.capabilities.specificDeviceClass, - supportedCCs: [...mockNode.implementedCCs.keys()], - }, + const nif = new ApplicationUpdateRequestNodeInfoReceived({ + nodeInformation: { + nodeId: node.id, + basicDeviceClass: mockNode.capabilities.basicDeviceClass, + genericDeviceClass: + mockNode.capabilities.genericDeviceClass, + specificDeviceClass: + mockNode.capabilities.specificDeviceClass, + supportedCCs: [...mockNode.implementedCCs.keys()], }, - ); + }); await mockController.sendMessageToHost(nif); await wait(100);