[FIX] fixed broken test after rebase (#485)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2026-01-27 14:38:26 +01:00
committed by GitHub
parent dafac94aec
commit d966a9eb2f
+26 -4
View File
@@ -111,9 +111,31 @@ describe("HandleLogin", () => {
// HandleLogin now returns null, loading is shown at App level via appLoading state
expect(screen.queryByTestId("loading")).not.toBeInTheDocument();
});
test("goes to error page when there is error in user data", () => {
const dispatch = appHooks.useAppDispatch();
renderWithProviders(<HandleLogin />, { user: { error: true } });
expect(dispatch).toHaveBeenCalledWith(push("/error"));
test("goes to error page when there is error in user data", async () => {
const mockDispatch = jest.fn();
jest.spyOn(appHooks, "useAppDispatch").mockReturnValue(mockDispatch);
renderWithProviders(<HandleLogin />, {
user: {
error: true,
loading: false,
userData: {
sub: "test",
email: "test@test.com",
sid: "testSid",
openpaasId: "testId",
},
tokens: { access_token: "test" },
},
calendars: {
pending: false,
error: false,
list: {},
},
});
await waitFor(() => {
expect(mockDispatch).toHaveBeenCalledWith(push("/error"));
});
});
});