August 2017
Beginner
374 pages
10h 41m
English
We also have to test another case - when the request fails. This happens, for example, when the user does not exist:
test('dispatches FETCH_USER_FAILURE when fetching fails', () => {
const username = 'nonexistant' const errorMsg = 'user not found' nock('http://localhost:8080/') .get(`/api/users/${username}`) .reply(404, { error: errorMsg })
const expectedActions = [ { type: actionTypes.FETCH_USER_REQUEST ...Read now
Unlock full access