From 4b4b434bf8b66df0d6f1f0a037544eb5223a9298 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Tue, 27 Jan 2026 21:04:54 -0500 Subject: [PATCH] Update session test mocks to use WsData type Change mock websocket objects in session tests to include both room and client fields, matching the WsData interface definition. --- src/session.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/session.test.ts b/src/session.test.ts index 39e66d5..59ae7d1 100644 --- a/src/session.test.ts +++ b/src/session.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; import * as Y from "yjs"; -import { getOrCreateSession, Session } from "./session"; +import { type WsData, getOrCreateSession, Session } from "./session"; describe("Session", () => { test("creates yjs doc on init", () => { @@ -13,8 +13,8 @@ describe("Session", () => { const session = new Session("test-room"); const mockWs = { send: () => {}, - data: { room: null as string | null }, - } as unknown as import("bun").ServerWebSocket<{ room: string | null }>; + data: { room: null as string | null, client: null }, + } as unknown as import("bun").ServerWebSocket; const client = { ws: mockWs }; expect(session.clients.size).toBe(0); @@ -36,8 +36,8 @@ describe("Session", () => { const mockWs = { send: () => {}, - data: { room: null as string | null }, - } as unknown as import("bun").ServerWebSocket<{ room: string | null }>; + data: { room: null as string | null, client: null }, + } as unknown as import("bun").ServerWebSocket; session.applyUpdate(update, { ws: mockWs }); expect(text.toString()).toBe("hello");