describe('get postals failed', () => {
it(`it should handle ${GET_POSTAL}`, () => {
const code = 'fail';
expect(reducer(state, { type: GET_POSTAL, code })).toEqual({
...state,
code,
loading: true,
});
});
const payload = {
error: {
errorMessage: 'test',
postalInfo: {},
}
};
state = reducer(state,{
GET_POSTAL_FAILED,
payload
});
expect(state).toEqual({
...state,
error: payload.error,
loading: false,
});
})
Фактический редуктор:
case constants.GET_POSTAL_FAILED:
return {
...state,
error: action.payload.error,
loading: false,
};
В ошибке:
Error: expect(received).toEqual(expected) // deep equality
- Expected
+ Received
Object {
- "error": Object {
- "errorMessage": "test",
- "postalInfo": Object {},
- },
- "loading": false,
"postalInfo": Object {},
}
Я пробовал разные вещи, но отказывается выдавать сообщение об ошибке ..