-
Notifications
You must be signed in to change notification settings - Fork 202
Unit Tests: Question About Setting Up NgReduxTestingModule #545
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
Comments
Not sure if this would be help but I think mockInstance method has been deprecated and replace with getInstance - check in @angular-redux/store/testing/ng-redux.mock.ts |
@graemeNorman Hello. I was originally using |
@lcecil I haven't had much luck with getting that module to work either - haven't found the documentation very useful. |
Since all of this is asynchronous, you should consider wrapping your test in fakeAsync:
Not sure if this helps or not. I've been using this mocking framework for a while. Took some effort to get it working. However, I have since abstracted Redux away from all of my components, so that I rarely, if ever, have to mock Redux. |
Hi @gregkopp , I ended up getting an answer in this thread: And you have the correct solution above - calling However, I'm not sure that wrapping it in a |
This is a...
What toolchain are you using for transpilation/bundling?
ngc
Environment
NodeJS Version: 8.11.2
Typescript Version: 2.7.2
Angular Version: 6.0.9
@angular-redux/store version: 9.0.0
@angular/cli version: (if applicable)
Description
I've read through the unit test examples, and believe that I have my set up correct. However, it seems like my mock instance is not being substituted for the real
NgRedux
that is injected.Simplified Code
Component
Unit Test
Error Message
When I run my tests with the code above, I get the message:
Expected spy getState to have been called.
Am I missing something in my set up?
The text was updated successfully, but these errors were encountered: