我对使用jasmine编写测试规范是个新手。我在ngOnInit()中有一个类似于router.url.includes(某个字符串)的条件。检查组件是否真实的默认规范测试用例显示TypeError: Cannot find includes of undefined失败。有没有办法窥探或模仿includes?
但我不知道如何模拟路由器,这是实例化HeroesComponent所需的。我试图用Jasmine创建一个间谍,但这不起作用,因为它缺少'RootComponentType‘属性。/heroes.component";import {HeroService} from ".HeroesComponent;