jeudi 8 juin 2017

Testing Observable.zip subscription

I have an Observable.zip() on which i subscribe It looks something like this:

 public awesomeMethod(){
   this.someObservable
    .zip(
     observable1,
     observable2,
    )
    .subscribe(data => {
     this.newData = data;
   }
 });
}

And i'd like to test this:

const zipObservable = Observable.of(data);

spyOn(component.zipObservable,'zip').and.returnValue(zipObservable);
component.awesomeMethod();

I need to know when the subscription has been called so i can if this.newData is what i expect.

Can someone tell me how to achieve this?

Aucun commentaire:

Enregistrer un commentaire