reduxjs / redux-mock-store

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

Add local reducer and method for change it #158

Open ananas7 opened 6 years ago

ananas7 commented 6 years ago

Sometimes we need to get store after use actions. Actually it's useful for testing containers. I found method replaceReducer, but it's not worked. Method replaceReducer do nothing

replaceReducer (nextReducer) {
      if (!isFunction(nextReducer)) {
          throw new Error('Expected the nextReducer to be a function.')
      }
}

I propose create local reducer and wrap state when get new action. InitialState is default value for reducer. This will make it convenient to receive a modified store.

jednano commented 5 years ago

See #145