I'm testing my reducer. I have no idea where I'm making mistake. Could you please help me with that
case SET_CONFIRM_INFO:
return {
...state,
confirmFields: action.confirmFields,
adding: (action.adding !== '') ? action.adding : [],
checkInfo: action.checkInfo,
getAddings: action.getAddings
};
here is my test:
it('SET_CONFIRM_INFO', () => {
const action = {
type: SET_CONFIRM_INFO,
confirmFields: [1, 2, 4],
adding: [1, 2, 3],
checkInfo: { 1: 'a', 2: 'b' },
getAddings: () => []
}
expect(pay(defaultState, action)).toEqual({
...defaultState,
confirmFields: action.confirmFields,
adding: action.adding,
checkInfo: action.checkInfo,
getAddings: () => []
})
})
and error:

Aucun commentaire:
Enregistrer un commentaire