Created
May 19, 2016 12:05
-
-
Save ferrannp/1ee189ded796f480861e88bdf1314966 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pit('calls request and failure actions if the fetch response was not successful', () => { | |
window.fetch = jest.fn().mockImplementation(() => Promise.resolve(mockResponse( | |
400, 'Test Error', '{"status":400, "statusText": Test Error!}'))); | |
return store.dispatch(fetchData(1234)) | |
.then(() => { | |
const expectedActions = store.getActions(); | |
expect(expectedActions.length).toBe(2); | |
expect(expectedActions[0]).toEqual({type: types.FETCH_DATA_REQUEST}); | |
expect(expectedActions[1]).toEqual({type: types.FETCH_DATA_FAILURE, | |
error: {status: 400, statusText: 'Test Error'}}); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
store is never defined here...