[FIX] fixed broken test after rebase (#485)
Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -111,9 +111,31 @@ describe("HandleLogin", () => {
|
|||||||
// HandleLogin now returns null, loading is shown at App level via appLoading state
|
// HandleLogin now returns null, loading is shown at App level via appLoading state
|
||||||
expect(screen.queryByTestId("loading")).not.toBeInTheDocument();
|
expect(screen.queryByTestId("loading")).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
test("goes to error page when there is error in user data", () => {
|
test("goes to error page when there is error in user data", async () => {
|
||||||
const dispatch = appHooks.useAppDispatch();
|
const mockDispatch = jest.fn();
|
||||||
renderWithProviders(<HandleLogin />, { user: { error: true } });
|
jest.spyOn(appHooks, "useAppDispatch").mockReturnValue(mockDispatch);
|
||||||
expect(dispatch).toHaveBeenCalledWith(push("/error"));
|
|
||||||
|
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"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user