This is a continuation of my previous question.
I tried testing for REGISTER_FAIL case. This is what i did:
test("should not register a user", async () => {
axios.mockRejectedValue({
status: 500,
});
const userInfo = {
name: "",
email: "",
password: "",
};
await store.dispatch(register(userInfo)).then(() => {
expect(store.getActions()[0]).toEqual({
type: REGISTER_FAIL,
payload: {
token: null,
isAuthenticated: false,
loading: true,
// user: null,
},
});
});
});
Aucun commentaire:
Enregistrer un commentaire