У меня есть действие ( redux-thunk ), и я хочу его протестировать. В действии я использую Ax ios для подключения к базе данных. Как я могу проверить это действие? Это код.
export const signUp = user => dispatch => {
dispatch(startSubmit('sign-up'));
return authAPI.signUp(user).then (user => {
dispatch(setUser(user));
dispatch(setNotify({open: true, content: 'Some content', type:
'success'}));
dispatch(stopSubmit('sign-up'));
}).catch(({response: {data}}) => {
let notification = null;
if ( data.messageList && data.messageList.length >= 0 ) {
notification = {content: data.messageList[0], open: true, type:
'error'};
dispatch (setNotify(notification));
return data.messageList;
}
dispatch(stopSubmit('sign-up'));
})
};
Спасибо)