Created
May 19, 2016 12:04
-
-
Save ferrannp/3f39555ea9d79c63cf1c23836a0570c1 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 success actions if the fetch response was successful', () => { | |
window.fetch = jest.fn().mockImplementation(() => | |
Promise.resolve(mockResponse(200, null, '{"id":"1234"}'))); | |
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_SUCCESS, id: 1234); | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think in the tutorial is missing something like
const store = mockStore({})
, or am I confused?