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

Spy on observables with Rx 5.5 #1537

Description

@nivekcode

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?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions