我正在为 angular 应用程序运行单元测试,我想对导航在 angular 应用程序中是否正常工作进行单元测试。
if (this.customer.length == 0) {
this.router.navigate(['/nocustomer']);
}
Run Code Online (Sandbox Code Playgroud)
以及为此的单元测试
it(`should navigate to nocustomer`,()=>{
component.customers.length=0;
//what must be written here to check this
})
Run Code Online (Sandbox Code Playgroud)