Closed hokrc01 closed 2 years ago
Thanks @hokrc01 !
So I think what you're looking for is subjectPropsToSpyOn
in the configuration right?
yes, that would be useful.
On Sat, Jun 12, 2021 at 6:23 PM Shai Reznik @.***> wrote:
Thanks @hokrc01 https://github.com/hokrc01 !
So I think what you're looking for is subjectPropsToSpyOn in the configuration right?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hirezio/auto-spies/issues/47#issuecomment-860120754, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYSBFQWAAHSHGU6YQJMWV3TSPM6VANCNFSM4ZVDXOUA .
Thanks @hokrc01 !
So I think what you're looking for is
subjectPropsToSpyOn
in the configuration right?
But isn't support for this already provided? I mean the example clearly shows it should support subjects
I have a problem, a simplest possible scenario I would say. I'm testing a function which calls this.service.mySubject.next();
.
this.service
is mocked like:
I get an error that says next is not a function, which is true because console.log says it has nextWith instead. Is there a different way to approach it? I just want to write expect(subject.next).toHaveBeenCalled(). Thanks
@hokrc01 @radzk Well, this functionality was meant to serve as a way to fake emits of observable / subject props before the actual "action" gets called.
Can you explain the need to spy on next()
?
Why not using observer-spy to listen to its emits instead?
Did not know it existed.
@hokrc01 cool, so I'm closing this issue for now
When I go to spy on a subject such as in this case
https://stackblitz.com/edit/subjecttest?file=src%2Fapp%2Fapp.component.spec.ts
I get an error
So what I am looking for is a SpyOnSuject Function. that would allow me to see if "next" has been called.
my current work around is to mock the service.