PhantomJS 2.1.1 (Windows 7 0.0.0)e Service should get by id from Service FAILED
Error: Unexpected request: GET /users/currentuser
No more request expected in /static/third-party/angularjs/1.4.7/js/angular-mocks.js (line 1245)
这是我收到的服务错误消息。在添加 angulartics 之前,我不会收到这些消息
有没有办法确保这些错误不会发生
我的测试代码:
beforeEach(function() {
module('appHost');
module('angulartics');
inject(function($httpBackend, _Service_) {
Service= _Service_;
httpBackend = $httpBackend;
});
});
afterEach(function() {
httpBackend.verifyNoOutstandingExpectation();
httpBackend.verifyNoOutstandingRequest();
});
it('should get template by id from Service', function() {
var expected = {
"name": "my name",
"description": "bla bla bla bla",
};
var id = "12345";
httpBackend.expectGET("/data/"+id).respond(expected);
});