-
Notifications
You must be signed in to change notification settings - Fork 127
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
Matching selector factories #151
Comments
Got the same problem today. Here my solution: (basically I match against the args instead of the selector function) .provide({
// assert that the selector got called with the correct resorucePath
// then mock the result
select(effect, next) {
if (isEqual(effect.args[0].resourcePath, [ 'placements', '2x3' ])) {
return { teaserIds: [ 1, 2 ] };
}
return next();
},
}) |
Ran into this today and fixed it by mocking the selectorFactory with jest mocks. In my case it was for the redux-form getFormInitialValues selector:
|
I solved this a different way, when I realised that the saga is calling a function to create the selector so it should be a
Then in your test you can just provide whatever you want for the selector, such as Jest mock or an empty function (since it never gets called, it's just to make sure it's the same function):
|
Hi,
I can't match selectors built using a factory.
Since the selector is built using a factory, each time I trigger the factory I get a different object. It seems that the matcher is failing in this case, the actual underlying selector is triggered (and fails).
Is there another way to match my selector ? Is there a way to mock
makeSelectStuffsForThisProject
so that it returns a dummy selector of my own, and insert it in the saga ?The text was updated successfully, but these errors were encountered: