我是服务器端测试meanjs的初学者。简介 我创建了一个服务,它调用执行 HTTP 的工厂。所以我想了解为什么会出现这个错误:
意外请求:获取图像 $httpBackend (/home/developer/mcd2/public/lib/angular-mocks/angular-mocks.js:1181) 预计不再有请求
-----MOCK-----
beforeEach(inject(function($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_,$filter,_Images_) {
// Set a new global scope
scope = $rootScope.$new();
// Point global variables to injected services
$stateParams = _$stateParams_;
$httpBackend = _$httpBackend_;
}
it('Test that takes the complete list of all the images in the DB (Images.get)',inject( function (ImagesREST) {
var Image = new ImagesREST({
namefile: 'Image_1',
width: 123,
height : 321,
extension : 'JPG',
tag : 'pippo',
size:9998,
type:'img/jpg',
path:'/asd/add',
rel:'/asd/Immagine1',
lastModified:new Date()
});
var arrayImages=[Image];
$httpBackend.expectGET('images').respond(arrayImages);
var lista = Images.get();
$httpBackend.flush();
console.log(lista);
}));
谢谢!