如何解决声明不包括在伊斯坦布尔
我有一个规范代码可以进行这样的测试。
it('service POST send Unsubscribe [success]',() => {
const dataPost = { detail: '' };
const resData = { data: { id: 10,email: 'dummy@gmail.com' },success: true,message: 'success'};
frontService.unsubscribeEmail(dataPost).subscribe((data: any) => {
expect(data.success).toBeTruthy();
component.sucessSend = true;
component.email = data.data.email;
fixture.detectChanges();
expect(component.email).toEqual(data.data.email);
expect(component.sucessSend).toEqual(true);
});
const req = httpTestingController.expectOne(`${frontService.prefixUrl}V2/unsubscribe`);
expect(req.request.method).toBe('POST');
req.flush(resData);
});
这项工作,但是当我运行代码覆盖率时。这行在文件ts中给出了错误
sendUnsubscribe() {
dataPost = { detail: '' };
this.frontService.unsubscribeEmail(dataPost).subscribe(data => { //data,function not covered
this.sucessSend = true; //statement not covered
this.email = data.email; //statement not covered
},error => { // error,function not covered
this.sucessSend = true; //statement not covered
});
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。