Suppress expected console.error output in error-path tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user