Created
October 22, 2018 08:02
-
-
Save tiagogomes772/94cec5fabbb4f21aabea7f47a9ac9f7c 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
describe('AsyncActions', () => { | |
beforeAll(() => { | |
mockStore = ReduxMockStore.default(middlewares); | |
initialState = {}; | |
}); | |
it('Does a getRandomAdvice succeful', () => { | |
fetch.mockResponse(JSON.stringify({slip: { | |
advice: 'Advice' | |
}})); | |
const expectedActions = [ | |
{ type: 'REQUEST_ADVICE' }, | |
{ payload: 'Advice', type: 'RESPONSE_ADVICE_SUCCESS' }, | |
]; | |
const store = mockStore(initialState); | |
return ( | |
store.dispatch(actions.getRandomAdvice()).then(() => { | |
expect(store.getActions()).toEqual(expectedActions); | |
}) | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment