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:
parent
65fd2b9e35
commit
15f381c6ad
1 changed files with 8 additions and 0 deletions
|
|
@ -42,6 +42,14 @@ describe("getWebProxiedFetch", () => {
|
||||||
expect(createRemoteFetchMock).toHaveBeenCalledTimes(2);
|
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 () => {
|
it("forwards a fetch that reaches the injected base fetch", async () => {
|
||||||
const inner = vi.fn<typeof fetch>(async () => new Response(null));
|
const inner = vi.fn<typeof fetch>(async () => new Response(null));
|
||||||
createRemoteFetchMock.mockImplementation(
|
createRemoteFetchMock.mockImplementation(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue