Javascript 错误:更新到AngularJS 1.6.1后,可能仍存在未处理的拒绝
我已经将angular升级到1.6.1,angular ui路由器升级到0.4.2 我仍然得到这个错误:/ 应用程序配置中的解决方案:Javascript 错误:更新到AngularJS 1.6.1后,可能仍存在未处理的拒绝,javascript,angularjs,unit-testing,karma-jasmine,Javascript,Angularjs,Unit Testing,Karma Jasmine,我已经将angular升级到1.6.1,angular ui路由器升级到0.4.2 我仍然得到这个错误:/ 应用程序配置中的解决方案:$qProvider.errorOnUnhandledRejections(false)不干净:/ 有人知道更好的解决办法吗 这是我的测试代码: beforeEach(function() { inject(function ($injector) { getResulfFile = $injector.get('GetResultFile');
$qProvider.errorOnUnhandledRejections(false)代码>不干净:/
有人知道更好的解决办法吗
这是我的测试代码:
beforeEach(function() {
inject(function ($injector) {
getResulfFile = $injector.get('GetResultFile');
httpMock = $injector.get('$httpBackend');
$q = $injector.get('$q');
deffered = $q.defer();
});
});
it('test promise reject of getResultFile.getResult', function() {
var message= "Not Found";
httpMock.expectGET('http://localhost:9999/v1/jmeter/' + id + '/results/' + rID).respond(500, message);
getResulfFile.getResult(id, rID).then(function(resp) {
}, function(resp) {
responseStatus = resp.status;
response = resp.data;
});
httpMock.flush();
expect(responseStatus).not.toBe(200);
expect(response).toBe('Not Found');
});