redux-mock-store icon indicating copy to clipboard operation
redux-mock-store copied to clipboard

Configuring store for all React tests

Open maksimgm opened this issue 5 years ago • 1 comments

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: {

maksimgm avatar May 09 '19 23:05 maksimgm

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

newyork-anthonyng avatar May 24 '19 15:05 newyork-anthonyng