mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
test(ui): accept expires-based cookie deletion in expired-token assertion
The auth context now clears the expired token via clearTokenCookies(), which deletes with an already-past expires date rather than the removed deleteCookie wrapper's Max-Age=0 write. The assertion was pinned to the mechanism instead of the behavior; it now accepts either deletion form
This commit is contained in:
parent
24ae260c74
commit
9237fe524c
1 changed files with 7 additions and 3 deletions
|
|
@ -215,7 +215,7 @@ describe("CreateKeyPage auth behavior", () => {
|
|||
return { exp: Math.floor(Date.now() / 1000) - 60 }; // expired 60s ago
|
||||
});
|
||||
|
||||
// Spy on cookie writes to ensure we clear with Max-Age=0
|
||||
// Spy on cookie writes to ensure we write a deletion for the token
|
||||
const cookieSetSpy = vi.spyOn(document, "cookie", "set");
|
||||
|
||||
// Act
|
||||
|
|
@ -228,9 +228,13 @@ describe("CreateKeyPage auth behavior", () => {
|
|||
);
|
||||
});
|
||||
|
||||
// And we attempted to clear the cookie (defensive deletion)
|
||||
// And we attempted to clear the cookie (defensive deletion, via either
|
||||
// Max-Age=0 or an already-past expires date)
|
||||
const wroteDeletion = cookieSetSpy.mock.calls.some(
|
||||
(args) => typeof args[0] === "string" && args[0].includes("Max-Age=0") && args[0].startsWith("token="),
|
||||
(args) =>
|
||||
typeof args[0] === "string" &&
|
||||
args[0].startsWith("token=;") &&
|
||||
(args[0].includes("Max-Age=0") || args[0].includes("expires=Thu, 01 Jan 1970")),
|
||||
);
|
||||
expect(wroteDeletion).toBe(true);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue