Skip to content

Issue with Store Helpers #174

@satheshrgs

Description

@satheshrgs

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

export const testFunction() {
const res = getValueFromHelper();
console.log(res);
}

helper.js

export const getValueFromHelper = () => store.getState.SomeReducer;

code.test.js

const store = mockStore({ SomeReducer:{} })
console.log(store.getState().SomeReducer);  // Here value is correct
testFunction(); // But here it returning original state value

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions