From 335b3f5be2deac2f456e7990bc26f8476765664c Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Tue, 22 Sep 2026 12:54:02 -0400 Subject: [PATCH] test(web): fix SPA client fetch mock types --- src/api/client.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/client.test.ts b/src/api/client.test.ts index 57ad53e..962a388 100644 --- a/src/api/client.test.ts +++ b/src/api/client.test.ts @@ -23,7 +23,11 @@ describe("unused SPA API client", () => { const fetchMock = vi.fn(async () => new Response(JSON.stringify({ stage: "local", sha: "x" }))); vi.stubGlobal("fetch", fetchMock); await apiFetch("/api/health", { headers: { Authorization: "Bearer leaked" } }); - const init = fetchMock.mock.calls[0]?.[1] as RequestInit; + expect(fetchMock).toHaveBeenCalledWith( + "/api/health", + expect.objectContaining({ credentials: "include" }), + ); + const init = fetchMock.mock.calls[0]?.[1] as unknown as RequestInit; expect(init.credentials).toBe("include"); const headers = new Headers(init.headers); expect(headers.get("Authorization")).toBeNull();