Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS路由测试未知提供程序_Angularjs_Testing_Jasmine_Karma Runner_Router - Fatal编程技术网

AngularJS路由测试未知提供程序

AngularJS路由测试未知提供程序,angularjs,testing,jasmine,karma-runner,router,Angularjs,Testing,Jasmine,Karma Runner,Router,我正试图在路由器上设置jasmine测试,就像这样 it('should map routes to controllers and templates', function() { inject(function($route) { module('igt'); expect($route.routes['/'].controller).toBe('mainPageCtrl'); expect($route.routes['/'].t

我正试图在路由器上设置jasmine测试,就像这样

it('should map routes to controllers and templates', function() {

    inject(function($route) {
        module('igt');

        expect($route.routes['/'].controller).toBe('mainPageCtrl');
        expect($route.routes['/'].templateUrl).toEqual('html/pages/main.html');

        // otherwise redirect to
        expect($route.routes[null].redirectTo).toEqual('/')
    });

});
而我的路由器文件是(因为它很长,所以只能乞讨):

我在karma.conf.js文件中插入了这些文件:

// list of files / patterns to load in the browser
files: [
    '../../node_modules/angular/angular.js',
    '../../node_modules/angular-mocks/angular-mocks.js',
    '../app.js',
    '../router.js',
    'unit/*.js'
],
现在,当我开始用业力开始测试时,它给了我错误:

错误:[$injector:unpr]未知提供程序:$routeProvider将其更改为

describe('Testing Routes', function () {
beforeEach(module('myApp'));
it('should map routes to controllers and templates', function($route) {
  expect($route.routes['/'].controller).toBe('mainPageCtrl');

现在我有了
phantomjs2.1.1(Windows 8 0.0.0)测试路由应该映射到控制器和模板失败类型错误:未定义不是单元/testAngularUnitSpec.js(第4行)中的对象(评估“$route.Routes['/'])
发生了什么?
describe('Testing Routes', function () {
beforeEach(module('myApp'));
it('should map routes to controllers and templates', function($route) {
  expect($route.routes['/'].controller).toBe('mainPageCtrl');