Fix biome lint errors in bridge.test.ts
This commit is contained in:
parent
ece0618a17
commit
063564b1cd
1 changed files with 5 additions and 7 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
||||||
import { spawn } from "bun";
|
import { spawn } from "bun";
|
||||||
import type { Subprocess } from "bun";
|
|
||||||
|
|
||||||
describe("Bridge lifecycle", () => {
|
describe("Bridge lifecycle", () => {
|
||||||
let daemon: ReturnType<typeof Bun.serve>;
|
let daemon: ReturnType<typeof Bun.serve>;
|
||||||
|
|
@ -131,7 +130,7 @@ describe("Bridge lifecycle", () => {
|
||||||
expect(output).toContain('"type":"ready"');
|
expect(output).toContain('"type":"ready"');
|
||||||
|
|
||||||
// send connect message
|
// send connect message
|
||||||
bridge.stdin.write(JSON.stringify({ type: "connect", room: "test" }) + "\n");
|
bridge.stdin.write(`${JSON.stringify({ type: "connect", room: "test" })}\n`);
|
||||||
|
|
||||||
// wait for connected message
|
// wait for connected message
|
||||||
({ value } = await reader.read());
|
({ value } = await reader.read());
|
||||||
|
|
@ -141,7 +140,7 @@ describe("Bridge lifecycle", () => {
|
||||||
expect(output).toContain('"room":"test"');
|
expect(output).toContain('"room":"test"');
|
||||||
|
|
||||||
// send disconnect message
|
// send disconnect message
|
||||||
bridge.stdin.write(JSON.stringify({ type: "disconnect" }) + "\n");
|
bridge.stdin.write(`${JSON.stringify({ type: "disconnect" })}\n`);
|
||||||
bridge.stdin.end();
|
bridge.stdin.end();
|
||||||
|
|
||||||
// bridge should exit cleanly
|
// bridge should exit cleanly
|
||||||
|
|
@ -162,26 +161,25 @@ describe("Bridge lifecycle", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const reader = bridge.stdout.getReader();
|
const reader = bridge.stdout.getReader();
|
||||||
const decoder = new TextDecoder();
|
|
||||||
|
|
||||||
// wait for ready
|
// wait for ready
|
||||||
await reader.read();
|
await reader.read();
|
||||||
|
|
||||||
// connect to room
|
// connect to room
|
||||||
bridge.stdin.write(JSON.stringify({ type: "connect", room: "content-test" }) + "\n");
|
bridge.stdin.write(`${JSON.stringify({ type: "connect", room: "content-test" })}\n`);
|
||||||
|
|
||||||
// wait for connected and peers messages
|
// wait for connected and peers messages
|
||||||
await reader.read();
|
await reader.read();
|
||||||
await reader.read();
|
await reader.read();
|
||||||
|
|
||||||
// send content
|
// send content
|
||||||
bridge.stdin.write(JSON.stringify({ type: "content", text: "hello world" }) + "\n");
|
bridge.stdin.write(`${JSON.stringify({ type: "content", text: "hello world" })}\n`);
|
||||||
|
|
||||||
// give it time to process
|
// give it time to process
|
||||||
await new Promise((r) => setTimeout(r, 100));
|
await new Promise((r) => setTimeout(r, 100));
|
||||||
|
|
||||||
// disconnect
|
// disconnect
|
||||||
bridge.stdin.write(JSON.stringify({ type: "disconnect" }) + "\n");
|
bridge.stdin.write(`${JSON.stringify({ type: "disconnect" })}\n`);
|
||||||
bridge.stdin.end();
|
bridge.stdin.end();
|
||||||
|
|
||||||
const exitCode = await bridge.exited;
|
const exitCode = await bridge.exited;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue