diff --git a/packages/zwave-js/src/lib/driver/Transaction.test.ts b/packages/zwave-js/src/lib/driver/Transaction.test.ts index 0c8b418767c1..abfe6ccaa000 100644 --- a/packages/zwave-js/src/lib/driver/Transaction.test.ts +++ b/packages/zwave-js/src/lib/driver/Transaction.test.ts @@ -1,12 +1,12 @@ import { NoOperationCC } from "@zwave-js/cc/NoOperationCC"; import { MessagePriority } from "@zwave-js/core"; import { type Message, getDefaultPriority } from "@zwave-js/serial"; +import { GetControllerVersionRequest } from "@zwave-js/serial/serialapi"; +import { RemoveFailedNodeRequest } from "@zwave-js/serial/serialapi"; +import { SendDataRequest } from "@zwave-js/serial/serialapi"; import test from "ava"; import type { ZWaveNode } from "../node/Node"; import { NodeStatus } from "../node/_Types"; -import { GetControllerVersionRequest } from "../serialapi/capability/GetControllerVersionMessages"; -import { RemoveFailedNodeRequest } from "../serialapi/network-mgmt/RemoveFailedNodeMessages"; -import { SendDataRequest } from "../serialapi/transport/SendDataMessages"; import type { Driver } from "./Driver"; import { type MessageGenerator, @@ -23,6 +23,9 @@ function createDummyMessageGenerator(msg: Message): MessageGenerator { self: undefined, current: undefined, parent: undefined as any, + reset() { + this.current = undefined; + }, }; } diff --git a/packages/zwave-js/src/lib/test/cc/CommandClass.test.ts b/packages/zwave-js/src/lib/test/cc/CommandClass.test.ts index 2da463646b1a..2c0c532cc1da 100644 --- a/packages/zwave-js/src/lib/test/cc/CommandClass.test.ts +++ b/packages/zwave-js/src/lib/test/cc/CommandClass.test.ts @@ -10,8 +10,8 @@ import { implementedVersion, } from "@zwave-js/cc"; import { CommandClasses } from "@zwave-js/core"; +import { SendDataRequest } from "@zwave-js/serial/serialapi"; import test from "ava"; -import { SendDataRequest } from "../../serialapi/transport/SendDataMessages"; @implementedVersion(7) @commandClass(0xffff as any) diff --git a/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts b/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts index 502a31cfc079..29684b2a7741 100644 --- a/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts +++ b/packages/zwave-js/src/lib/test/compat/invalidCallbackFunctionTypes.test.ts @@ -1,6 +1,15 @@ import { WakeUpTime, ZWaveProtocolCCAssignSUCReturnRoute } from "@zwave-js/cc"; import { TransmitStatus, ZWaveDataRate } from "@zwave-js/core"; import { FunctionType } from "@zwave-js/serial"; +import { + AssignSUCReturnRouteRequest, + AssignSUCReturnRouteResponse, +} from "@zwave-js/serial/serialapi"; +import { + DeleteSUCReturnRouteRequest, + DeleteSUCReturnRouteRequestTransmitReport, + DeleteSUCReturnRouteResponse, +} from "@zwave-js/serial/serialapi"; import { type MockControllerBehavior, createMockZWaveRequestFrame, @@ -10,15 +19,6 @@ import { MockControllerCommunicationState, MockControllerStateKeys, } from "../../controller/MockControllerState"; -import { - AssignSUCReturnRouteRequest, - AssignSUCReturnRouteResponse, -} from "../../serialapi/network-mgmt/AssignSUCReturnRouteMessages"; -import { - DeleteSUCReturnRouteRequest, - DeleteSUCReturnRouteRequestTransmitReport, - DeleteSUCReturnRouteResponse, -} from "../../serialapi/network-mgmt/DeleteSUCReturnRouteMessages"; import { integrationTest } from "../integrationTestSuite"; // Repro for https://github.com/zwave-js/node-zwave-js/issues/6363 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 98f828d14a37..d1f0be6db1f1 100644 --- a/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts +++ b/packages/zwave-js/src/lib/test/driver/assemblePartialCCs.test.ts @@ -5,12 +5,12 @@ import { MultiCommandCCCommandEncapsulation } from "@zwave-js/cc/MultiCommandCC" import { SecurityCCCommandEncapsulation } from "@zwave-js/cc/SecurityCC"; import { AssociationCommand } from "@zwave-js/cc/safe"; import { CommandClasses, ZWaveError, ZWaveErrorCodes } from "@zwave-js/core"; +import { ApplicationCommandRequest } from "@zwave-js/serial/serialapi"; import { MockController, MockNode } from "@zwave-js/testing"; import ava, { type TestFn } from "ava"; import { createDefaultMockControllerBehaviors } from "../../../Utils"; import type { Driver } from "../../driver/Driver"; import { createAndStartTestingDriver } from "../../driver/DriverMock"; -import { ApplicationCommandRequest } from "../../serialapi/application/ApplicationCommandRequest"; interface TestContext { driver: Driver; 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 b7d5311af2bd..7591f70e8848 100644 --- a/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts +++ b/packages/zwave-js/src/lib/test/driver/computeNetCCPayloadSize.test.ts @@ -2,12 +2,12 @@ import { FirmwareUpdateMetaDataCC } from "@zwave-js/cc/FirmwareUpdateMetaDataCC" import { MultiChannelCCCommandEncapsulation } from "@zwave-js/cc/MultiChannelCC"; import { SecurityCCCommandEncapsulation } from "@zwave-js/cc/SecurityCC"; import { EncapsulationFlags, TransmitOptions } from "@zwave-js/core"; +import { SendDataRequest } from "@zwave-js/serial/serialapi"; import { MockController } from "@zwave-js/testing"; import ava, { type TestFn } from "ava"; import { createDefaultMockControllerBehaviors } from "../../../Utils"; import type { Driver } from "../../driver/Driver"; import { createAndStartTestingDriver } from "../../driver/DriverMock"; -import { SendDataRequest } from "../../serialapi/transport/SendDataMessages"; interface TestContext { driver: Driver; @@ -46,13 +46,11 @@ test("should compute the correct net payload sizes", (t) => { const testMsg1 = new SendDataRequest({ command: new SecurityCCCommandEncapsulation({ nodeId: 2, - ownNodeId: driver.ownNodeId, - securityManager: driver.securityManager!, encapsulated: {} as any, }), transmitOptions: TransmitOptions.DEFAULT, }); - testMsg1.command.encapsulated = undefined as any; + testMsg1.command!.encapsulated = undefined as any; t.is(driver.computeNetCCPayloadSize(testMsg1), 26); const multiChannelCC = new MultiChannelCCCommandEncapsulation({ @@ -63,8 +61,6 @@ test("should compute the correct net payload sizes", (t) => { const testMsg2 = new SendDataRequest({ command: new SecurityCCCommandEncapsulation({ nodeId: 2, - ownNodeId: driver.ownNodeId, - securityManager: driver.securityManager!, encapsulated: multiChannelCC, }), transmitOptions: TransmitOptions.NoRoute, diff --git a/packages/zwave-js/src/lib/test/driver/controllerJammed.test.ts b/packages/zwave-js/src/lib/test/driver/controllerJammed.test.ts index 74beb19e964a..5a7023b04c3f 100644 --- a/packages/zwave-js/src/lib/test/driver/controllerJammed.test.ts +++ b/packages/zwave-js/src/lib/test/driver/controllerJammed.test.ts @@ -7,6 +7,13 @@ import { getZWaveChipType, } from "@zwave-js/core"; import { FunctionType } from "@zwave-js/serial"; +import { SoftResetRequest } from "@zwave-js/serial/serialapi"; +import { + SendDataAbort, + SendDataRequest, + SendDataRequestTransmitReport, + SendDataResponse, +} from "@zwave-js/serial/serialapi"; import { type MockControllerBehavior } from "@zwave-js/testing"; import { wait } from "alcalzone-shared/async"; import sinon from "sinon"; @@ -14,13 +21,6 @@ import { MockControllerCommunicationState, MockControllerStateKeys, } from "../../controller/MockControllerState"; -import { SoftResetRequest } from "../../serialapi/misc/SoftResetRequest"; -import { - SendDataAbort, - SendDataRequest, - SendDataRequestTransmitReport, - SendDataResponse, -} from "../../serialapi/transport/SendDataMessages"; import { integrationTest } from "../integrationTestSuite"; import { integrationTest as integrationTestMulti } from "../integrationTestSuiteMulti"; diff --git a/packages/zwave-js/src/lib/test/driver/nodeAsleepNoReject.test.ts b/packages/zwave-js/src/lib/test/driver/nodeAsleepNoReject.test.ts index 4b7ced4e020a..d92785fac513 100644 --- a/packages/zwave-js/src/lib/test/driver/nodeAsleepNoReject.test.ts +++ b/packages/zwave-js/src/lib/test/driver/nodeAsleepNoReject.test.ts @@ -1,9 +1,9 @@ import { BasicCCGet, BasicCCSet } from "@zwave-js/cc"; import { MessagePriority, NodeStatus } from "@zwave-js/core"; +import { type SendDataRequest } from "@zwave-js/serial/serialapi"; import { MOCK_FRAME_ACK_TIMEOUT, MockZWaveFrameType } from "@zwave-js/testing"; import { wait } from "alcalzone-shared/async"; import path from "node:path"; -import { type SendDataRequest } from "../../serialapi/transport/SendDataMessages"; import { integrationTest } from "../integrationTestSuite"; // Repro from #1078 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 d5c1d155ad4c..43e3d0d066b8 100644 --- a/packages/zwave-js/src/lib/test/driver/receiveMessages.test.ts +++ b/packages/zwave-js/src/lib/test/driver/receiveMessages.test.ts @@ -1,9 +1,9 @@ import { WakeUpCCIntervalSet } from "@zwave-js/cc/WakeUpCC"; +import { ApplicationCommandRequest } from "@zwave-js/serial/serialapi"; import { MockController } from "@zwave-js/testing"; import ava, { type TestFn } from "ava"; import type { Driver } from "../../driver/Driver"; import { createAndStartTestingDriver } from "../../driver/DriverMock"; -import { ApplicationCommandRequest } from "../../serialapi/application/ApplicationCommandRequest"; interface TestContext { driver: Driver; @@ -43,7 +43,9 @@ test.serial( wakeUpInterval: 5, }), }); - controller.serial.emitData(req.serialize(driver)); + controller.serial.emitData( + req.serialize(driver["getEncodingContext"]()), + ); await controller.expectHostACK(1000); t.pass(); }, diff --git a/packages/zwave-js/src/lib/test/driver/secureAndSupervisionEncap.test.ts b/packages/zwave-js/src/lib/test/driver/secureAndSupervisionEncap.test.ts index e3958984527c..889d99bcefad 100644 --- a/packages/zwave-js/src/lib/test/driver/secureAndSupervisionEncap.test.ts +++ b/packages/zwave-js/src/lib/test/driver/secureAndSupervisionEncap.test.ts @@ -1,7 +1,7 @@ import { SecurityCCNonceGet } from "@zwave-js/cc"; import { CommandClasses } from "@zwave-js/core"; +import { SendDataRequest } from "@zwave-js/serial/serialapi"; import path from "node:path"; -import { SendDataRequest } from "../../serialapi/transport/SendDataMessages"; import { integrationTest } from "../integrationTestSuite"; integrationTest( diff --git a/packages/zwave-js/src/lib/test/driver/sendDataAbortAfterTimeout.test.ts b/packages/zwave-js/src/lib/test/driver/sendDataAbortAfterTimeout.test.ts index 18d87f88d962..a9206ca96abd 100644 --- a/packages/zwave-js/src/lib/test/driver/sendDataAbortAfterTimeout.test.ts +++ b/packages/zwave-js/src/lib/test/driver/sendDataAbortAfterTimeout.test.ts @@ -6,14 +6,14 @@ import { } from "../../controller/MockControllerState"; import { TransmitStatus } from "@zwave-js/core"; -import { SoftResetRequest } from "../../serialapi/misc/SoftResetRequest"; +import { SoftResetRequest } from "@zwave-js/serial/serialapi"; import { SendDataAbort, SendDataRequest, SendDataRequestTransmitReport, SendDataResponse, -} from "../../serialapi/transport/SendDataMessages"; +} from "@zwave-js/serial/serialapi"; import { integrationTest } from "../integrationTestSuite"; let shouldTimeOut: boolean; 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 b9de6e4f3b09..53e9d33900c7 100644 --- a/packages/zwave-js/src/lib/test/driver/sendDataMissingCallbackAbort.test.ts +++ b/packages/zwave-js/src/lib/test/driver/sendDataMissingCallbackAbort.test.ts @@ -13,23 +13,23 @@ import { ZWaveErrorCodes, assertZWaveError, } from "@zwave-js/core"; -import path from "node:path"; -import Sinon from "sinon"; -import { determineNIF } from "../../controller/NodeInformationFrame"; import { SerialAPIStartedRequest, SerialAPIWakeUpReason, -} from "../../serialapi/application/SerialAPIStartedRequest"; -import { SoftResetRequest } from "../../serialapi/misc/SoftResetRequest"; +} from "@zwave-js/serial/serialapi"; +import { SoftResetRequest } from "@zwave-js/serial/serialapi"; import { RequestNodeInfoRequest, RequestNodeInfoResponse, -} from "../../serialapi/network-mgmt/RequestNodeInfoMessages"; +} from "@zwave-js/serial/serialapi"; import { SendDataAbort, SendDataRequest, SendDataResponse, -} from "../../serialapi/transport/SendDataMessages"; +} from "@zwave-js/serial/serialapi"; +import path from "node:path"; +import Sinon from "sinon"; +import { determineNIF } from "../../controller/NodeInformationFrame"; import { integrationTest } from "../integrationTestSuite"; import { integrationTest as integrationTestMulti } from "../integrationTestSuiteMulti"; diff --git a/packages/zwave-js/src/lib/test/driver/sendDataMissingResponse.test.ts b/packages/zwave-js/src/lib/test/driver/sendDataMissingResponse.test.ts index 4d65daafb1dc..a54177c9a97d 100644 --- a/packages/zwave-js/src/lib/test/driver/sendDataMissingResponse.test.ts +++ b/packages/zwave-js/src/lib/test/driver/sendDataMissingResponse.test.ts @@ -17,7 +17,7 @@ import { SendDataAbort, SendDataRequest, SendDataRequestTransmitReport, -} from "../../serialapi/transport/SendDataMessages"; +} from "@zwave-js/serial/serialapi"; import { integrationTest } from "../integrationTestSuite"; let shouldTimeOut: boolean; diff --git a/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts b/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts index 97119f7365fe..a3b3009c460a 100644 --- a/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts +++ b/packages/zwave-js/src/lib/test/driver/unresponsiveStick.test.ts @@ -1,13 +1,13 @@ import { ZWaveErrorCodes, assertZWaveError } from "@zwave-js/core"; import { FunctionType } from "@zwave-js/serial"; -import { type MockControllerBehavior } from "@zwave-js/testing"; -import { wait } from "alcalzone-shared/async"; -import Sinon from "sinon"; import { GetControllerIdRequest, type GetControllerIdResponse, -} from "../../serialapi/memory/GetControllerIdMessages"; -import { SoftResetRequest } from "../../serialapi/misc/SoftResetRequest"; +} from "@zwave-js/serial/serialapi"; +import { SoftResetRequest } from "@zwave-js/serial/serialapi"; +import { type MockControllerBehavior } from "@zwave-js/testing"; +import { wait } from "alcalzone-shared/async"; +import Sinon from "sinon"; import { integrationTest } from "../integrationTestSuite"; let shouldRespond = true; 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 f1730da94fb9..623f835c33e3 100644 --- a/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts +++ b/packages/zwave-js/src/lib/test/node/legacyRefreshActuatorSensorCCs.test.ts @@ -4,9 +4,9 @@ import { MultilevelSwitchCCSet, } from "@zwave-js/cc"; import { CommandClasses } from "@zwave-js/core"; +import { ApplicationUpdateRequestNodeInfoReceived } from "@zwave-js/serial/serialapi"; import { type MockNodeBehavior, MockZWaveFrameType } from "@zwave-js/testing"; import { wait } from "alcalzone-shared/async"; -import { ApplicationUpdateRequestNodeInfoReceived } from "../../serialapi/application/ApplicationUpdateRequest"; import { integrationTest } from "../integrationTestSuite"; integrationTest(