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.
This commit is contained in:
parent
00c9a140c6
commit
4b4b434bf8
1 changed files with 5 additions and 5 deletions
|
|
@ -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<WsData>;
|
||||
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<WsData>;
|
||||
session.applyUpdate(update, { ws: mockWs });
|
||||
|
||||
expect(text.toString()).toBe("hello");
|
||||
|
|
|
|||
Loading…
Reference in a new issue