代码在运行单元测试时被执行,但显示未覆盖
我有一个自定义的异步验证器,该验证器验证位置 newstopcontrol:new FormControl('',[valiorators.required],[this.validateLocation()]
在成功验证时,它调用了另一个功能,该功能将值填充到几个输入字段中。
validateLocation() {
this.locationservice.isValid().subscribe(res => {
if(res) {
this.populateTime()
}
})
}
并基于某种条件,PopulateTime功能调用另一个功能。
populateTime() {
this.addform.patchValue({time:someValue})
if(someValue) {
this.populateDate();
}
}
所有功能在测试和涵盖时都在执行,但最后一个功能即人口()显示即使执行也没有覆盖。
I have a custom async validator which validate locationnewStopControl:new FormControl('',[Validators.required],[this.validateLocation()]
on success validation it calls another function which populates value to few input fields.
validateLocation() {
this.locationservice.isValid().subscribe(res => {
if(res) {
this.populateTime()
}
})
}
and based on some condition populateTime function calls another function.
populateTime() {
this.addform.patchValue({time:someValue})
if(someValue) {
this.populateDate();
}
}
all functions are executing while test and covered as well but the last function i.e populatedate() shows not covered even it is executing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论