test: type logout audit fetch mock
This commit is contained in:
@@ -2,12 +2,15 @@ import { completeLogout, reportLogoutAudit } from "./logoutFlow";
|
|||||||
|
|
||||||
describe("reportLogoutAudit", () => {
|
describe("reportLogoutAudit", () => {
|
||||||
it("starts an authenticated keepalive request", async () => {
|
it("starts an authenticated keepalive request", async () => {
|
||||||
const fetcher = jest.fn(async () => ({ ok: true }) as Response);
|
const fetcher = jest.fn(
|
||||||
|
async (_input: RequestInfo | URL, _init?: RequestInit) =>
|
||||||
|
({ ok: true }) as Response,
|
||||||
|
);
|
||||||
|
|
||||||
await reportLogoutAudit({
|
await reportLogoutAudit({
|
||||||
endpoint: "https://server.example/api/v1/audit-events",
|
endpoint: "https://server.example/api/v1/audit-events",
|
||||||
accessToken: "access-token",
|
accessToken: "access-token",
|
||||||
fetcher,
|
fetcher: fetcher as typeof fetch,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(fetcher).toHaveBeenCalledTimes(1);
|
expect(fetcher).toHaveBeenCalledTimes(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user