jestjs - 如何在角度和笑话的条件下修复发现分支
问题描述
嗨,我已经在 if 条件下使用 jest 中的表单值实现了测试用例。
if (this.accountForm.get('account')?.value === 'No' ) {
this.router.navigateByUrl(/home);
}else {
this.router.navigateByUrl(/profile);
}
测试用例代码
component.accountForm.patchValue({ ['account']: 'Yes' });
解决方案
推荐阅读
- tensorflow - TPU 与 TensorFlow v1
- azure - 为什么 Azure Devops 文件复制静态网站不复制到根目录?
- python - Selenium/Python 根据同一行中的值单击表格单元格中的超链接
- android - 如何通过单击按钮更新自定义 ListView
- ios - 如何在 Swift 中的 UIViewController 和 NSObject 之间传递数据
- android - Xamarin 表单 API 在发布模式下无法正常工作
- mysql - 第 4033 行出错:) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
- r - R markdown knitr 设置 pdf 输出版本
- activemq-artemis - ActiveMQ Artemis - 按顺序处理消息
- java - 将 Shedlock 与 mongo 一起使用时如何解决此编解码器错误