diff --git a/tests/stores/files.test.js b/tests/stores/files.test.js index 93e5027..8d513e1 100644 --- a/tests/stores/files.test.js +++ b/tests/stores/files.test.js @@ -215,9 +215,13 @@ describe("filesStore", () => { }); it("returns early for invalid id without throwing", async () => { + const spy = vi.spyOn(console, "error").mockImplementation(() => {}); + await expect(store.deleteFile("log", null)).resolves.toBeUndefined(); expect(mockDelete).not.toHaveBeenCalled(); + expect(spy).toHaveBeenCalledWith("Delete File API Error: invalid id"); + spy.mockRestore(); }); }); diff --git a/tests/stores/login.test.js b/tests/stores/login.test.js index 2080b20..a2db3c3 100644 --- a/tests/stores/login.test.js +++ b/tests/stores/login.test.js @@ -147,11 +147,14 @@ describe("loginStore", () => { }); it("sets isInvalid on error", async () => { + const spy = vi.spyOn(console, "error").mockImplementation(() => {}); axios.post.mockRejectedValue(new Error("401")); await store.signIn(); expect(store.isInvalid).toBe(true); + expect(spy).toHaveBeenCalledWith("Login failed:", expect.any(Error)); + spy.mockRestore(); }); }); @@ -197,11 +200,14 @@ describe("loginStore", () => { }); it("redirects to login on error", async () => { + const spy = vi.spyOn(console, "error").mockImplementation(() => {}); mockClientGet.mockRejectedValue(new Error("401")); await store.checkLogin(); expect(store.$router.push).toHaveBeenCalledWith("/login"); + expect(spy).toHaveBeenCalledWith("Session check failed:", expect.any(Error)); + spy.mockRestore(); }); });