Reputation: 1007
I am getting the following error when executing jasmine test cases.
Error: Unexpected request: GET templates/login.html No more request expected at $httpBackend (D:/Src/Rep/myapp/js/angular-mocks/angular-mocks.js:1244:9) at sendReq (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:10515:9) at serverRequest (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:10222:16) at processQueue (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:14745:28) at D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:14761:27 at Scope.$eval (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:15989:28) at Scope.$digest (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:15800:31) at ChildScope.$apply (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:16097:24) at UserContext. (D:/Src/Rep/myapp/tests/controllers/myController-test.js:128:15) at Object.invoke (D:/Src/Rep/myapp/js/angularjs/1.4.7/angular.js:4478:17) Error: Declaration Location at window.inject.angular.mock.inject (D:/Src/Rep/myapp/js/angular-mocks/angular-mocks.js:2409:25) at Suite. (D:/Src/Rep/myapp/tests/controllers/myController-test.js:118:73) at D:/Src/Rep/myapp/tests/controllers/myController-test.js:1:1
I don't understand what does this error means. I tried to use
$httpBackend.whenGET("/templates/login.html").passThrough();
as well as
$httpBackend.when('GET', 'templates/login.html')
.respond(200, '');
in my code but no luck.
Can someone please suggest?
Upvotes: 0
Views: 174
Reputation: 1007
Finally, adding following line at the start of my test case worked for me. $httpBackend.whenGET(/templates/).respond(200, '');
Example:
it('Validate something', inject(function(SomeService) {
$httpBackend.whenGET(/templates/).respond(200, '');
.......
.......
}));
Upvotes: 0