I'm trying to mock up My API properly (as seen in question Mocking API with httpBackend [Protractor]). I'm navigating to specific URL - 'http://0.0.0.0:9000/#/organizations/profile'. Url requests specific view as seen here:
Error: Unexpected request: GET vcs/common/layouts/main/view.html
No more request expected
at $httpBackend (angular-mocks.js:1211)
at sendReq (angular.js:9667)
at serverRequest (angular.js:9383)
at processQueue (angular.js:13248)
at angular.js:13264
at Scope.$eval (angular.js:14466)
at Scope.$digest (angular.js:14282)
at Scope.$apply (angular.js:14571)
at bootstrapApply (angular.js:1455)
at Object.invoke (angular.js:4203)
I have trouble in understanding how 'whenPOST(url, [data], [headers]);' method works. How can i use it properly in my current code? Here's my code:
describe('e2e tests', function() {
it('FO tests', function() {
browser.addMockModule('WebClientApp', function() {
console.log('test');
angular.module('WebClientApp', ['ngMockE2E'])
.run(function($httpBackend) {
console.log('test2');
$httpBackend.whenPOST('http://0.0.0.0:9000/api/organizations').respond(200);
$httpBackend.whenPOST('/api/auth/get_resource_by_token').respond(200);
$httpBackend.whenGET('/api/auth/current_resource').respond(200);
$httpBackend.whenGET(/.*/).respond(200);
});
});
browser.getRegisteredMockModules();
browser.get('http://0.0.0.0:9000/#/organizations/profile');
browser.pause();
});
});