This commit is contained in:
Bertie690 2025-07-25 19:47:26 -04:00
parent 4b1979edf7
commit ea63a9e41b

View File

@ -37,14 +37,16 @@ describe("Test misc", () => {
it.skip("test apifetch mock async", async () => { it.skip("test apifetch mock async", async () => {
const spy = vi.fn(); const spy = vi.fn();
await apiFetch("https://localhost:8080/account/info").then(response => { await apiFetch("https://localhost:8080/account/info")
expect(response.status).toBe(200); .then(response => {
expect(response.ok).toBe(true); expect(response.status).toBe(200);
return response.json(); expect(response.ok).toBe(true);
}).then(data => { return response.json();
spy(); // Call the spy function })
expect(data).toEqual({ "username": "greenlamp", "lastSessionSlot": 0 }); .then(data => {
}); spy(); // Call the spy function
expect(data).toEqual({ username: "greenlamp", lastSessionSlot: 0 });
});
expect(spy).toHaveBeenCalled(); expect(spy).toHaveBeenCalled();
}); });