Проблема с методом angular.mock.inject

Я использую контрольный кейс с жасмином

'use strict';

describe('companyService', function() {

    var $httpBackend, companyService;

    beforeEach(angular.mock.module('myApp'));

    beforeEach(angular.mock.inject(function(_$httpBackend_ ,  _companyService_) {
        $httpBackend = _$httpBackend_;
        companyService = _companyService_;
    }));

    it('should return a promise for getCompany function', function() {
       // expect(typeof companyService.getCompany('foobar').then).toBe('function');
    }); 

});

я получаю следующую ошибку. как вы можете видеть выше. я ничего не делаю внутриЭто блок.

    minErr/<@C:/Users/userone/Documents/myAppPkg/myApp/WebApiRole/bower_components/angular/angular.js:63:12
       loadModules/<@C:/Users/userone/Documents/myAppPkg/myApp/WebApiRole/bower_components/angular/angular.js:4138:15
       forEach@C:/Users/userone/Documents/myAppPkg/myApp/WebApiRole/bower_components/angular/angular.js:323:11
       loadModules@C:/Users/userone/Documents/myAppPkg/myApp/WebApiRole/bower_components/angular/angular.js:4099:5
       createInjector@C:/Users/userone/Documents/myAppPkg/myApp/WebApiRole/bower_components/angular/angular.js:4025:11
       workFn@C:/Users/userone/Documents/myAppPkg/myApp/WebApiRole/node_modules/angular-mocks/angular-mocks.js:2425:44
irefox 38.0.0 (Windows 8.1): Executed 1 of 1 (1 FAILED) ERROR (0.251 secs / 0.008 secs)

Я предполагаю, что эта проблема возникает из-за метода angular.mock.inject, который я использовал. посколькуисполнение не введите следующий блок

beforeEach(angular.mock.inject(function(_$httpBackend_ , _companyService_) {
        $httpBackend = _$httpBackend_;
        companyService = _companyService_;
    }));

Файл Karma.conf.js

// Karma configuration
// Generated on Thu May 21 2015 16:24:51 

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],


    // list of files / patterns to load in the browser
    files: [
            'bower_components/angular/angular.js',
            'node_modules/angular-mocks/angular-mocks.js',
            'app/app.js',
            'app/*.js',
            'app/**/*.js',
            'app/**/**/*.js',
            'app/company/CompanyService.js',
            'test/company/*.js'
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


     // web server port
        hostname: 'localhost',
        port: 44555,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Firefox'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false
  });
};

Может ли кто-нибудь помочь мне с этим. ?

Ответы на вопрос(2)

Ваш ответ на вопрос