From 15f381c6ad34d8b751395ba8a3373748413c1da9 Mon Sep 17 00:00:00 2001 From: cliffhall Date: Fri, 28 Aug 2026 01:00:42 -0400 Subject: [PATCH] test(auth): cover the no-window guard in getWebProxiedFetch (#2144) Mirrors `remoteOAuthStorage.test.ts`, whose identical guard is covered the same way. Without it the file sat at 83.33% branches and failed the per-file gate. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_0177mPHAdECD18nLLCTwR5rh Signed-off-by: cliffhall --- clients/web/src/lib/webProxiedFetch.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clients/web/src/lib/webProxiedFetch.test.ts b/clients/web/src/lib/webProxiedFetch.test.ts index 84f7420b..aeb544eb 100644 --- a/clients/web/src/lib/webProxiedFetch.test.ts +++ b/clients/web/src/lib/webProxiedFetch.test.ts @@ -42,6 +42,14 @@ describe("getWebProxiedFetch", () => { expect(createRemoteFetchMock).toHaveBeenCalledTimes(2); }); + it("throws when window is unavailable", () => { + vi.stubGlobal("window", undefined); + expect(() => getWebProxiedFetch()).toThrow( + "getWebProxiedFetch requires a browser environment", + ); + vi.unstubAllGlobals(); + }); + it("forwards a fetch that reaches the injected base fetch", async () => { const inner = vi.fn(async () => new Response(null)); createRemoteFetchMock.mockImplementation(