sdyl405w4: Remove the sign-out feature and the Minnect revoke call
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
endSession,
|
||||
ensureFreshSession,
|
||||
refreshSession,
|
||||
} from "@/lib/session-refresh";
|
||||
@@ -113,27 +112,3 @@ describe("refreshSession failure", () => {
|
||||
expect(getSession(id)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("endSession", () => {
|
||||
it("revokes the refresh token and deletes the session", async () => {
|
||||
const id = seedSession(Date.now() + 60 * 60_000);
|
||||
const fetchImpl = vi.fn(async (_input: RequestInfo | URL) => json({ data: { success: true } }));
|
||||
|
||||
await endSession(id, { fetchImpl: fetchImpl as unknown as typeof fetch });
|
||||
|
||||
expect(fetchImpl.mock.calls.some(([u]) => String(u).endsWith("/api/v4/auth/revoke-token"))).toBe(true);
|
||||
expect(getSession(id)).toBeNull();
|
||||
});
|
||||
|
||||
it("still deletes the session when revoke throws", async () => {
|
||||
const id = seedSession(Date.now() + 60 * 60_000);
|
||||
const fetchImpl = vi.fn(async (_input: RequestInfo | URL): Promise<Response> => {
|
||||
throw new Error("revoke down");
|
||||
});
|
||||
|
||||
await expect(
|
||||
endSession(id, { fetchImpl: fetchImpl as unknown as typeof fetch }),
|
||||
).resolves.toBeUndefined();
|
||||
expect(getSession(id)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user