Skip to content
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

MockReducerManager.addReducers is not a function when testing #2776

Closed
nagyadam2092 opened this issue Nov 9, 2020 · 2 comments · Fixed by #2777
Closed

MockReducerManager.addReducers is not a function when testing #2776

nagyadam2092 opened this issue Nov 9, 2020 · 2 comments · Fixed by #2777

Comments

@nagyadam2092
Copy link
Contributor

As per the guideline states, I already asked my general support question on SO: https://stackoverflow.com/questions/64715061/addreducer-missing-on-mockstore
but didn't get any answers yet, so I opened an Issue instead, sorry if this is still not following the guidelines.
Basically my question is that what is the proposed setup if my code uses ReducerManager.addReducers in a test environment. Our setup relies on dynamically adding reducers to the store, but this ReducerManager.addReducers call breaks tests with this error: this.reducerManager.addReducers is not a function.
What is the suggested way of testing modules that are calling ReducerManager.addReducers? Maybe adding this as noop calls would solve the issue? (like this PR: https:/ngrx/platform/pull/2265/files)

@alex-okrushko
Copy link
Member

Hi @nagyadam2092
Thank you for going with the guideline recommendation at first. Btw, we also have a Discord Server now (discord.gg/ngrx) - it's one of the fastest way to bring it to the community's attention.

You are right - adding these methods and making them a noop should solve your immediate issue.

In the meantime you might to extend MockReducerManager in your code and provide it in your tests instead.

Do you want to send a PR for the fix?

@nagyadam2092
Copy link
Contributor Author

Thanks for the reply @alex-okrushko ! Didn't know about the Discord community, going to check it!
Opened #2777 for the quick fix of the described behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants