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) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177mPHAdECD18nLLCTwR5rh
Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-28 01:00:42 -04:00
commit 15f381c6ad

View file

@ -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<typeof fetch>(async () => new Response(null));
createRemoteFetchMock.mockImplementation(