Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Spy on observables with Rx 5.5 #1537

Open
nivekcode opened this issue Dec 20, 2017 · 0 comments
Open

Spy on observables with Rx 5.5 #1537

nivekcode opened this issue Dec 20, 2017 · 0 comments

Comments

@nivekcode
Copy link

nivekcode commented Dec 20, 2017

Hi there

I am trying to use lettable operators in my project. The productive code works without problems but I am struggling with the tests. Inside my tests I want to use Jasmine Spy to be in control on what my Observable returns. With the old syntax I was able to write the following:

spyOn(Observable.prototype, 'switchMap').and.returnValue(Observable.of(myValue))
or
spyOn(Observable, 'of').and.returnValue(Observable.of(myValue))

I thought that the same should look like the snippet below with the new syntax
spyOn(ArrayObservable, 'of').and.returnValue(of('Superman'))
Is this possible with lettable operators or is it generally a bad idea to test observable chains with the help of spies?

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

No branches or pull requests

1 participant