test(frontend): simplify fetch mock signatures in auth tests
This commit is contained in:
1 parent
02ff53229c
commit
568112b85a
1 file changed
+6
-8
@@ -440,7 +440,7 @@ describe("auth and user list wiring", () => {
|
||||
it("logs in and updates the auth UI", async () => {
|
||||
await import("../src/main");
|
||||
|
||||
globalThis.fetch = vi.fn(async (url: any, opts?: any) => {
|
||||
globalThis.fetch = vi.fn(async (url: any) => {
|
||||
const u = String(url);
|
||||
if (u.includes("/api/auth/login")) {
|
||||
return {
|
||||
@@ -470,13 +470,11 @@ describe("auth and user list wiring", () => {
|
||||
it("toggles the user list visibility", async () => {
|
||||
await import("../src/main");
|
||||
|
||||
globalThis.fetch = vi
|
||||
.fn()
|
||||
.mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({ authenticated: false, entries: [] }),
|
||||
text: async () => "",
|
||||
}) as any;
|
||||
globalThis.fetch = vi.fn().mockResolvedValue({
|
||||
ok: true,
|
||||
json: async () => ({ authenticated: false, entries: [] }),
|
||||
text: async () => "",
|
||||
}) as any;
|
||||
|
||||
document.dispatchEvent(new Event("DOMContentLoaded"));
|
||||
|
||||
|
||||
Reference in new issue
Block a user