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(