I have the following action creator:
export const doSomething () {
return (dispatch, getState) => {
setTimeout(function () {
dispatch(someAction('bbb'));
}, 3000);
}
}
It changes some part of a state to bbb
, where state is created from combined reducers. How can I test this?
import configureMockStore from 'redux-mock-store'
import thunk from 'redux-thunk'
it('', function (done) {
const middlewares = [ thunk ]
const mockStore = configureMockStore(middlewares)
const store = mockStore({}) // how should the store look like?
return store.dispatch(someAction('bbb'))
.then(() => {
expect(store.getActions()).toEqual(expectedActions)
})
});
How should mocked store look like? Is this the right apporach? How do I test this?