Jasmine unit testing: inject http service
<p>I have the next service "IrChartService":</p>

<pre><code>public getDataAfterUpdate(entityId: number, timestamp: number) {
    var deferred = this.$q.defer();
    var requestUrl = this.IrChartData + '/datasequences/entities/' + entityId + '/ir?timestamp=' + timestamp;

    this.$http.get(requestUrl).then((result) =&gt; {
        deferred.resolve(result.data);
    });

    return deferred.promise;

}
</code></pre>

<p>That service is used in a controller.
Here I have the test file:</p>

<pre><code>  /* Test Code */
    describe('IrChartService', function () {
        var IrChartService, $httpBackend, $q, IrChartData;

        beforeEach(function(){
            angular.module('genscape.rt.irchart')
        });
        beforeEach(inject(function(_$httpBackend_, _IrChartService_, _$q_, _IrChartData_) {

            IrChartService = _IrChartService_;
            $httpBackend = _$httpBackend_;
            $q = _$q_;
            IrChartData = _IrChartData_;
        }));

        it('is defined', function () {
            console.log('def');
            expect(IrChartService).toBeDefined();
        });

        it('should call the backend testurl',  function() {
            var returnData = {
                "ImagePath": "/20160406/167/167_20160406_065626.jpg",
                "ConfidenceValue": 4
            };
            console.log('test');
            //7. expectGET to make sure this is called once.
            $httpBackend.expectGET("../mock/chartData.specs.json").respond(returnData);

            $httpBackend.flush();

        });
    });
</code></pre>

<p>It return me errors like:
Error: [$injector:unpr] <a href="http://errors.angularjs.org/1.4.0-rc.2/" rel="nofollow">http://errors.angularjs.org/1.4.0-rc.2/</a>$injector/unpr?p0=IrChartServiceProvider%20%3C-%20IrChartService</p>

<p>TypeError: Cannot read property 'expectGET' of undefined</p>

<p>Expected undefined to be defined.</p>

<p>Can you help me, please? Thanks!</p>

<p>Update:</p>

<pre><code>// Karma configuration
// Generated on Wed May 20 2015 15:52:13 GMT-0400 (Eastern Daylight Time)

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'],

        plugins: [
            'karma-chrome-launcher',
            'karma-jasmine',
            'karma-html-reporter',
            'karma-ng-html2js-preprocessor'
        ],

        // list of files / patterns to load in the browser
        files: [
             'Scripts/angular.min.js',
             'Scripts/angular-mocks.js',
             'Scripts/genscape.common.js',
             'app/template.module.js',
             'app/app.module.js',
             'app/templates.js',
             'app/app.widget.service.js',
             'app/IRchart/IRchart.service.js',
             'app/IRchart/IRchart.controller.js',
             'app/IRchart/IRchart.directive.js',
             'app/IRchart/IRchart-error.directive.js',
             'app/IRchart/IRchart-popup/IRchart-popup.controller.js',
             'app/IRchart/IRchart-player/IRchart-player.controller.js',
             'app/IRchart/IRchart-player/IRchart-player.directive.js',
             'test/specs/specs.js',

              // fixtures
             { pattern: 'test/mock/*.json', watched: true, served: true, included: false }
        ],

        preprocessors: {
            '**/*.html': ['ng-html2js']
        },

        ngHtml2JsPreprocessor: {
            // we want all templates to be loaded in the same module called 'templates'
            moduleName: 'genscape.rt.irchart'
        },

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

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


        // web server port
        port: 9876,


        // 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: ['Chrome'],
        browsers: ['Chrome'],


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