How can I cover the catchError in my angular test?
this.service.method().pipe(
tap(ret=>{
console.log('my return', ret);
}),
catchError(error=>{
console.log('error occured');
return throwError(error);
})
).subscribe();
In my test, I mocked the service and the method.
let serviceMock = jasmine.createSpyObj('Service',{
method: of({message: 'success'})
})
Codes inside tap is covered but not in catchError.