I am using folloing jasmine test case
'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');
});
});
i am getting the following error . as you can see above . i am not doing anything inside it block .
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)
I assume this issue comes because of the angular.mock.inject method i have been using . because the execution does not enter the following block
beforeEach(angular.mock.inject(function(_$httpBackend_ , _companyService_) {
$httpBackend = _$httpBackend_;
companyService = _companyService_;
}));
Karma.conf.js file
// 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
});
};
can any one help me out with this . ?