From d654a1bcdf925d0002cfa43049a4c0b3714f79a8 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Tue, 27 Jan 2026 21:03:52 -0500 Subject: [PATCH] Add proper typing to integration test websocket mocks Import and apply WsData type to the test server's websocket handlers to ensure mock websocket objects match production typing. --- src/integration.test.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/integration.test.ts b/src/integration.test.ts index 5ece57e..5b1c1d3 100644 --- a/src/integration.test.ts +++ b/src/integration.test.ts @@ -1,7 +1,12 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test"; import type { ServerMessage } from "./protocol"; import { decode } from "./protocol"; -import { getOrCreateSession, getSession, removeSession } from "./session"; +import { + type WsData, + getOrCreateSession, + getSession, + removeSession, +} from "./session"; describe("WebSocket concurrent edits integration", () => { let server: ReturnType; @@ -9,7 +14,7 @@ describe("WebSocket concurrent edits integration", () => { beforeEach(() => { // start server for each test - server = Bun.serve({ + server = Bun.serve({ port: PORT, fetch(req, server) { const url = new URL(req.url);