I have a method in my testComponent that returns an observable which is been subscribed to and after been unsubscribe from, then it runs the code in the .add() (i.e when the subscription is been unsubscribed from)
How do i spy on this method and watch the actions taking place when the subscribe method is called and when the add() method when unsubscribed from the subscription. Thanks
Here goes the code sample
const loading;
const done;
const error;
onClick() {
this.loading = true;
this.myService.processData(someValues)
.subscribe(
result => {
this.done = true;
},
error => {
this.error = true;
} )
.add(() => { this.loading = false })
}
I need a way to watch what's happening in the subscribe() and add() block.