-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Store Helpers #174
Comments
Probably you have a typo here: export const getValueFromHelper = () => store.getState.SomeReducer; should be export const getValueFromHelper = () => store.getState().SomeReducer; Also you are referring to the global variable called So here you have 2 options.
helper.js export const getValueFromHelper = (store) => store.getState.SomeReducer; code.test.js const store = mockStore({ SomeReducer:{} })
console.log(store.getState().SomeReducer); // Here value is correct
testFunction(store); // But here it returning original state value code.js export const testFunction(state) {
const res = getValueFromHelper(state);
console.log(res);
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a scenario in which a method uses Store Helper to get State. When I try to test the function using the mock store which I have created, it uses the original store instance ( since it is in a helper file).
code.js
helper.js
code.test.js
The text was updated successfully, but these errors were encountered: