Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jan 31, 2025
1 parent 08d8ee0 commit fbf2f61
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
9 changes: 5 additions & 4 deletions packages/config/src/ConfigManager.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ZWaveLogContainer } from "@zwave-js/core";
import { type LogContainer } from "@zwave-js/core";
import { fs } from "@zwave-js/core/bindings/fs/node";
import { log as createZWaveLogContainer } from "@zwave-js/core/bindings/log/node";
import { pathExists } from "@zwave-js/shared";
import fsp from "node:fs/promises";
import { tmpdir } from "node:os";
Expand All @@ -13,7 +14,7 @@ import { syncExternalConfigDir } from "./utils.js";
interface LocalTestContext {
context: {
tempDir: string;
logContainer: ZWaveLogContainer;
logContainer: LogContainer;
logger: ConfigLogger;
};
}
Expand All @@ -28,7 +29,7 @@ const test = baseTest.extend<LocalTestContext>({
const tempDir = path.join(tmpdir(), "zwavejs_test");
await fsp.mkdir(tempDir, { recursive: true });

const logContainer = new ZWaveLogContainer({ enabled: false });
const logContainer = createZWaveLogContainer({ enabled: false });
const logger = new ConfigLogger(logContainer);

// Run tests
Expand Down Expand Up @@ -213,7 +214,7 @@ async function testDeviceConfigPriorityDir(
// And load the file
const cm = new ConfigManager({
deviceConfigPriorityDir: priorityDir,
logContainer: new ZWaveLogContainer({ enabled: false }),
logContainer: createZWaveLogContainer({ enabled: false }),
});
await cm.loadAll();

Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/log/Controller.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { log as createZWaveLogContainer } from "@zwave-js/core/bindings/log/node";
import { beforeEach, test as baseTest } from "vitest";
import { CommandClasses } from "../definitions/CommandClasses.js";
import { InterviewStage } from "../definitions/InterviewStage.js";
Expand All @@ -7,7 +8,7 @@ import {
assertMessage,
} from "../test/SpyTransport.js";
import { ControllerLogger } from "./Controller.js";
import { ZWaveLogContainer, createDefaultTransportFormat } from "./shared.js";
import { createDefaultTransportFormat } from "./shared.js";

// Extend the test conte

Expand All @@ -25,7 +26,7 @@ const test = baseTest.extend<LocalTestContext>({
const spyTransport = new SpyTransport();
spyTransport.format = createDefaultTransportFormat(true, true);
const controllerLogger = new ControllerLogger(
new ZWaveLogContainer({
createZWaveLogContainer({
transports: [spyTransport],
}),
);
Expand Down
4 changes: 2 additions & 2 deletions packages/serial/src/serialport/ZWaveSerialStream.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ZWaveLogContainer } from "@zwave-js/core";
import { log as createZWaveLogContainer } from "@zwave-js/core/bindings/log/node";
import { Bytes } from "@zwave-js/shared";
import { isUint8Array } from "node:util/types";
import {
Expand Down Expand Up @@ -35,7 +35,7 @@ const test = baseTest.extend<LocalTestContext>({
context.port = port;
context.factory = new ZWaveSerialStreamFactory(
port.factory(),
new ZWaveLogContainer({ enabled: false }),
createZWaveLogContainer({ enabled: false }),
);

// Run tests
Expand Down
4 changes: 2 additions & 2 deletions packages/zwave-js/src/lib/log/Driver.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
MessagePriority,
ZWaveLogContainer,
createDefaultTransportFormat,
getDirectionPrefix,
} from "@zwave-js/core";
import { log as createZWaveLogContainer } from "@zwave-js/core/bindings/log/node";
import {
SpyTransport,
assertLogInfo,
Expand Down Expand Up @@ -43,7 +43,7 @@ const test = baseTest.extend<LocalTestContext>({
spyTransport.format = createDefaultTransportFormat(true, true);
const driverLogger = new DriverLogger(
driver,
new ZWaveLogContainer({
createZWaveLogContainer({
transports: [spyTransport],
}),
);
Expand Down
8 changes: 3 additions & 5 deletions packages/zwave-js/src/lib/test/driver/SerialLogger.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {
ZWaveLogContainer,
createDefaultTransportFormat,
} from "@zwave-js/core";
import { createDefaultTransportFormat } from "@zwave-js/core";
import { log as createZWaveLogContainer } from "@zwave-js/core/bindings/log/node";
import { SpyTransport, assertMessage } from "@zwave-js/core/test";
import { SerialLogger } from "@zwave-js/serial";
import { Bytes } from "@zwave-js/shared/safe";
Expand All @@ -24,7 +22,7 @@ const test = baseTest.extend<LocalTestContext>({
const spyTransport = new SpyTransport();
spyTransport.format = createDefaultTransportFormat(true, true);
const serialLogger = new SerialLogger(
new ZWaveLogContainer({
createZWaveLogContainer({
transports: [spyTransport],
}),
);
Expand Down

0 comments on commit fbf2f61

Please sign in to comment.