【发布时间】:2018-06-04 08:24:56
【问题描述】:
我需要测试函数提交。我有这个代码:
onAddProd() {
this.areWeWaiting = true;
let newProd= new Product(
this.addProdForm.value
);
this.ws.createProduct(newProd).subscribe( //createProduct is function service
result => {
if (result === true) {
this.router.navigate(['/home']);
} else {
this.areWeWaiting = false;
}
},
error => {
this.areWeWaiting = false;
}
);
}
我基本上需要测试。
- 如果结果为真,应该导航到/home
你能给我建议吗?
【问题讨论】:
标签: angular unit-testing testing jasmine