angular - 如何在角度测试用例中配置路由器
问题描述
在我的 Angular 4 应用程序中,我正在为一个导航到不同路线的方法编写一个测试用例。在我的测试用例中,我正在导入 RouterTestingModule.withRoutes 并传递路由。
const testRoutes: Routes = [ { path: 'sampleApp', component: SampleComponent}];
imports: [RouterTestingModule.withRoutes(testRoutes)]
这似乎不起作用我仍然得到错误,
角茉莉错误:'未处理的承诺拒绝:','无法匹配任何路线。网址段...
我该如何解决这个问题。
解决方案
推荐阅读
- sparql - SPARQL 过滤器 xsd:Date 失败
- angular - 以角度动态更改颜色和状态
- c++ - 由于从 C 到 C++ 的类型转换,无法编译并出现错误 C2440
- r - Spearman 相关性和拆分 1 个变量
- python-3.x - 未能部署 Travis CI `Python`
- android - 使用搜索视图的特定标题(从 api 获取)?
- java - 如何增加标头大小限制Tomcat Java
- php - 使用 PHP 将 Oracle BLOB 导入 MySQL 时,OCI-Lob 无法转换为字符串错误
- vb.net - 在文本框中显示一个值,该值链接到我的 ComboBox 中的字符串
- c++ - 如何删除除ArduinoSTL的向量函数之外的所有函数