reduxjs / redux-mock-store

A mock store for testing Redux async action creators and middleware.
MIT License
2.5k stars 149 forks source link

Configuring store for all React tests #165

Open maksimgm opened 5 years ago

maksimgm commented 5 years ago

I want to know if there is a way to configure jest and enzyme tests to contain a react store? I'm aware that there is a way to configure a store for an individual react component when it is connected with redux. I have a helper method which returns an array of react components which are untested. So instead of testing all 20 react components, I think configuring a mock store should solve it. This is my error:

FAIL  src/core/factory/__tests__/searchFactory.test.js
  ● Test suite failed to run

    TypeError: Cannot read property 'reducers' of undefined

      26 | const oidcMiddleware = createOidcMiddleware(mgr, true, false, API_LOGIN_CALLBACK, null);
      27 | 
    > 28 | const store = init({
         |               ^
      29 |   models,
      30 |   plugins: [selectorsPlugin()],
      31 |   redux: {
newyork-anthonyng commented 5 years ago

@maksimgm Can you create a minimal project that reproduces this?