I'm unit testing a angular directive with Angular and Jasmine. Mocking the http backend works fine and all tests working fine locally. But on the build server i get:
Error: Unexpected request: GET app/auth/views/login.html No more request expected (line 1419) $httpBackend@bower_components/angular-mocks/angular-mocks.js:1419:90 n@build/vendor.js:222:54 build/vendor.js:219:263 build/vendor.js:254:21 $eval@build/vendor.js:268:347 $digest@build/vendor.js:265:425
My test setup:
beforeEach(angular.mock.module("app"));
beforeEach(() => {
inject(function ($injector, _$compile_, _$rootScope_) {
// The injector unwraps the underscores (_) from around the parameter names when matching
$compile = _$compile_;
$rootScope = _$rootScope_;
$httpBackend = $injector.get("$httpBackend");
});
$httpBackend.whenGET("api/langs/gb.json").respond({ "COMMON.HOME": homeName });
$httpBackend.whenGET("api/langs/de.json").respond({});
$httpBackend.whenGET("app/home/views/dashboard.html").respond(200, "");
$httpBackend.whenGET("app/home/views/login.html").respond(200, "");
$httpBackend.whenGET(/^private\/auth\?.*/).respond({});
directiveElem = getCompiledElement();
});
What is different on the build server. I can't explain this behavior.