0
新角TDD,和我得到一个错误,对此我无法调试,任何见解将是有益的误差角JS服务TDD
我有一个服务文件
angular.module('myApp')
.service('usersLocationService', function() {
this.SetLocation = function (place) {
var address = {};
//some code
return address;
};
});
我的人缘.conf.js有这个
files: [
'test/unitTest/spec/client/lib/angular.min.js',
'test/unitTest/spec/client/lib/angular-mocks.js',
'public/Services/*.js',
'test/unitTest/spec/client/**/*.js'
],
我的测试文件是
"use strict";
describe('Test Suite for UserLocationService', function() {
var usersLocationService, httpBackend;
beforeEach(inject(function ($httpBackend, _usersLocationService_) {
module('myApp');
usersLocationService = _usersLocationService_;
httpBackend = $httpBackend;
}));
it('Should return the address from the google location place', function() {
var place = {};
var data = this.usersLocationService.SetLocation(place);
console.log(place);
});
});
,我得到的错误是
错误:[$注射器:NOMOD] http://errors.angularjs.org/1.5.7/ $喷油器/ NOMOD P0 = MyApp来 在C:/project/test/unitTest/spec/client/lib/angular.min .js:6
这个错误出现在主服务文件中,而不是在specFile中,为了确认,我将服务文件中的值更改为myServices,角度错误成为nomod?p0 = myServices。我错过了任何需要添加的库吗?
尝试删除'',并添加'beforeEach(模块( '对myApp'));前'beforeEach(注(功能'( $ httpBackend,_usersLocationService_' – varit05
我之前尝试过,beforeEach(module('myApp')); beforeEach(inject)之前,没有工作,什么是remove''? –
您是否删除了模块('myApp') ;当你尝试? – varit05