Closed mauriguz closed 5 years ago
How was this issue resolved?
@arvinsim I was able to fix it by changing the way I was importing redux actions into the components.
When the error was happening I was importing actions like import { userActions } from '../path/to/redux;
path/to/redux is pointing to an index file that it was only importing reducer, helpers and saga and exporting all together with diff names.
Later I changed that to import * as userActions from '../path/to/reducer;
I stopped using the index file and that was enough to fix the issue.
Hey guys, I'm having an issue with redux-persist when trying to run unit tests on certain components. As the title says, baseReducer inside of _nodemodules/redux-persist/lib/persistReducer.js is not a function.
This only happens when running npm test, which in reality is just running jest + enzyme using CRA's config. Running the app in dev or prod works perfectly.
As far I was able to track, the reducer I pass to persistReducer is not "right", but my concern is that I have no idea why that could be happening, after all, some tests work fine, even if they're connected to redux.
During my research I couldn't find any similar issue/solution, the only one similar is #762 but that's not exactly my issue, so I'm kinda lost in the shadows right now. So far this seems related to redux-persist, but maybe I'm wrong? Any help would be appreciated!
Store.js
Redux modules index.js
Test file
Reducer file
This is the version I'm using "redux-persist": "^5.10.0",