我是Angular JS的新手,并尝试在mocha中为我的服务编写单元测试,但每次运行时都会低于错误。请建议。
TypeError: 'undefined' is not a function (evaluating 'expect(InfoService).toBeDefined()')
单元测试:
describe('Unit: InfoService', function () {
var InfoService;
var httpMock;
beforeEach(angular.mock.module('app.Info'));
beforeEach(angular.mock.module(function ($provide) {
$provide.value('CONSTANT', {
DETAIL_URL:'/test/someurl/'
});
}));
beforeEach(inject(function($httpBackend,InfoService) {
InfoService = InfoService;
httpMock = $httpBackend;
}));
it('InfoService should exist', function(InfoService){
expect(InfoService).toBeDefined();
});
});