mirror of
https://github.com/Sea-Haven-Industries/seahaven-ap.git
synced 2026-10-01 19:03:22 +00:00
test(web): fix SPA client fetch mock types
This commit is contained in:
parent
9ae54d4a2a
commit
335b3f5be2
1 changed files with 5 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue