Skip to content

Commit 1e1bbdb

Browse files
committed
fix: ensure window.api is undefined in API tests
The CI environment may have window.api defined, causing the APIProvider to use the Electron client path instead of the WebSocket path, resulting in no MockWebSocket instances being created. Change-Id: Ic971f4e0fe8dd6efc997b04a42181eaae626b2b8 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 1961eea commit 1e1bbdb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/browser/contexts/API.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ describe("API reconnection", () => {
9393
globalThis.window = window as unknown as Window & typeof globalThis;
9494
globalThis.document = window.document as unknown as Document;
9595
globalThis.WebSocket = MockWebSocket as unknown as typeof WebSocket;
96+
// Ensure we're not in Electron mode (would skip WebSocket)
97+
(globalThis.window as unknown as Record<string, unknown>).api = undefined;
9698
// Mock import.meta.env
9799
(globalThis as Record<string, unknown>).import = {
98100
meta: { env: { VITE_BACKEND_URL: "http://localhost:3000" } },

0 commit comments

Comments
 (0)