Update test format (#821)

* Lint tests, format JSON

* Update test formatting

---------

Co-authored-by: philon- <philon-@users.noreply.github.com>
This commit is contained in:
Jeremy Gallant
2025-08-31 21:30:11 -04:00
committed by GitHub
co-authored by philon-
parent ee131c3681
commit 90cf136b8c
13 changed files with 124 additions and 93 deletions
@@ -1,7 +1,7 @@
import { describe, vi, expect, beforeEach, afterEach, it } from "vitest";
import { Duplex } from "node:stream";
import type { SerialPort } from "serialport";
import { Types, Utils } from "@meshtastic/core";
import type { SerialPort } from "serialport";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { runTransportContract } from "../../../tests/utils/transportContract";
import { TransportNodeSerial } from "./transport";
@@ -112,21 +112,21 @@ describe("TransportNodeSerial (contract)", () => {
return transport;
},
pushIncoming: async (bytes) => {
(globalThis as unknown as { __fakePort: FakeSerialPort }).__fakePort.pushIncoming(
bytes,
);
(
globalThis as unknown as { __fakePort: FakeSerialPort }
).__fakePort.pushIncoming(bytes);
await Promise.resolve();
},
assertLastWritten: (bytes) => {
const port =
(globalThis as unknown as { __fakePort: FakeSerialPort }).__fakePort;
const port = (globalThis as unknown as { __fakePort: FakeSerialPort })
.__fakePort;
expect(port.lastWritten).toBeDefined();
expect(port.lastWritten).toEqual(bytes);
},
triggerDisconnect: async () => {
(globalThis as unknown as { __fakePort: FakeSerialPort }).__fakePort.emitErrorOnce(
"test-disconnect",
);
(
globalThis as unknown as { __fakePort: FakeSerialPort }
).__fakePort.emitErrorOnce("test-disconnect");
await Promise.resolve();
},
});