对代码进行一些更改,因为我想尝试一些新特性,因此我从使用构造函数()切换到使用inject()导入服务。现在我的测试失败了,我似乎找不到任何关于如何测试它的文档。如何将测试更改为使用inject()方式。// old testing code let service: ResetService;
let servic
目前,我正在挣扎于单元测试我的canActivate()方法从我的路由器警卫服务。现在谈一下单元测试的部分内容:
const routerStub: Router = jasmine.createSpyObjto user overview - if has not permission', inject([ProfileGuard], (servic
我有一个调用地理定位器的函数,但我不知道如何测试这个函数。我尝试过侦察地理定位器并返回假数据,但没有成功,原始函数仍在使用,因此我将不得不等待,我不能使用模拟数据。// this doesn't work
var navigator_spy = spyOn( navigator.geolocation, 'getCurrentPosition' )