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.
This commit is contained in:
Jared Miller 2026-01-27 21:03:52 -05:00
parent 0235b2c3e6
commit d654a1bcdf
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -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<typeof Bun.serve>;
@ -9,7 +14,7 @@ describe("WebSocket concurrent edits integration", () => {
beforeEach(() => {
// start server for each test
server = Bun.serve({
server = Bun.serve<WsData>({
port: PORT,
fetch(req, server) {
const url = new URL(req.url);