I have this in my react component
console.log(await store.dispatch(getAndSaveImages()));
and my test is:
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
it("should call redux store...", () => {
const store = mockStore({ auth: { isAuth: true } })
store.dispatch = jest.fn(() => Promise.resolve("its working"));
component = mount(<Provider store={store}><User history={mockedHistory}/></Provider>);
});
The problem is that it doesnt mock the dispatch function.