Jest Test Thunk
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
const middlewares = [thunk]
const mockStore = configureMockStore(middleware)
describe('async actions', () => {
it('should dispatch actions of ConstantA and ConstantB', () => {
const expectedActions = [
{type: CONSTANT_A, payload: 'a'},
{type: CONSTANT_B, payload: 'b'}
]
const store = mockStore({ yourInitialState })
store.dispatch(actions.functionA('a', 'b'))
expect(store.getActions()).toEqual(expectedActions)
})
})
Distinct Dogfish