-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
MockInstance
on component injected as a provider does not work for falsy values
#2087
Comments
Hi there! I do :) I hope :) and yourself? Thanks for the report, I'll take a look on the upcoming weekend. |
Yeah I've quite recently level up with No problem, no rush, I've found a way to avoid this issue by initializing my props with the falsy values by default, but I can't restore them to falsy. |
Glad to hear about the level up :) Feel free to share thoughts and ideas you have. |
fix(MockInstance): correctly accepts falsy values #2087
v13.2.0 has been released and contains a fix for the issue. Feel free to reopen the issue or to submit a new one if you meet any problems. |
Hey there ! Hope you are doing well !
In one of my tests, a mocked component is injected as a provider in my actually tested component, and
MockInstance
seems to not work as expected: it does mock only truthy values, not falsy ones.See the demo here: https://stackblitz.com/edit/github-ytvy85?file=src/test.spec.ts
What is strange is that the behavior is inconsistent:
I think the problem comes from here: https://github.com/ike18t/ng-mocks/blob/0cfd6dc7f2cb2e95fdff3ca68433460e0a89f308/libs/ng-mocks/src/lib/mock-instance/mock-instance.ts#L182-L184
Have a nice day, and thanks again for the great lib ;)
The text was updated successfully, but these errors were encountered: