test(web): fix SPA client fetch mock types

This commit is contained in:
Adam Moussa 2026-09-22 12:54:02 -04:00
parent 9ae54d4a2a
commit 335b3f5be2
No known key found for this signature in database

View file

@ -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();