how to test react-saga axios post
Since you have specified a body ({ userName: '[email protected]', password: 'xxxxx' }
) in your nock
mocking, it won't respond loginReply
until it gets a post request with both given URL and body. But you don't send credentials
with your LOGIN_REQUEST
action and hence your axios request body( payload.data
) is always going to be empty. That's why your nock
mocking doesn't reply within specified async timeout and jest
give this timeout error.
To fix this you either have to remove the specified body in your nock
setup or dispatch LOGIN_REQUEST
action with credentials and change the specified body to match encoded credentials you set to payload
.
You received the following error : Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL
because you didn't call the done
callback in your test.