我正在使用Angular 8和Jasmine 3.4,并且在测试以下代码方面遇到一些困难
ngOnInit(){
this.myService.myMethod().subscribe(
responseOk => {
// some code
},
responseKo => {
if (responseKo instanceof HttpErrorResponse) {
if (responseKo.status === 404) {
// some code
} else if (responseKo.status === 403) {
// some code
} else {
throw responseKo;
}
} else {
throw responseKo;
}
});
}
如何对代码为“ throw responseKo”的分支进行单元测试?