Angularjs 角度:注入服务时单元测试失败

Angularjs 角度:注入服务时单元测试失败,angularjs,unit-testing,ionic,karma-jasmine,Angularjs,Unit Testing,Ionic,Karma Jasmine,我开始对现有的Angular/ionic应用程序进行单元测试,我已经安装了karma和jasmine。 我为一个服务编写了第一个单元测试,但它失败了,出现了以下错误: Error: [$injector:unpr] Unknown provider: followServiceProvider <- followService 这是它的单元测试: 'use strict'; describe('Service: followService Test Follow APIs', func

我开始对现有的
Angular/ionic
应用程序进行单元测试,我已经安装了
karma
jasmine
。 我为一个服务编写了第一个单元测试,但它失败了,出现了以下
错误

Error: [$injector:unpr] Unknown provider: followServiceProvider <- followService
这是它的单元测试:

'use strict';

describe('Service: followService Test Follow APIs', function () {
    // load the service's module
    beforeEach(module('myApp.services'));

    // instantiate service
    var followService;
    var $httpBackend;

    beforeEach(inject(function (_$httpBackend_, _followService_) {
        followService = _followService_;
        $httpBackend = _$httpBackend_;
    }));

      it('should GET Followers from the server', function () {
        $httpBackend.expectGET('api/users/followers').respond(200, {"id": "55d1c1acddb6dabe468bbba1", "displayName": "Brand1", "pictrue": "path/to/picture"});

        var followers = followService.getFollowers();

        $httpBackend.flush();

        expect(followers).not.toBe(null);
    });
});

你确定Karma捡起了保存followService的文件吗?它是否包含在Karma配置中?检查Karma
config
文件似乎缺少一个目录:$@AhmadElmoualem您想回答您自己的问题,说明如何在Karma配置中包含服务注入吗?您确定Karma选择了包含以下服务的文件吗?它是否包含在Karma配置中?检查Karma
config
文件似乎缺少一个目录:$@AhmadElmoualem您是否愿意回答您自己的问题,说明如何在Karma配置中包含服务注入?
'use strict';

describe('Service: followService Test Follow APIs', function () {
    // load the service's module
    beforeEach(module('myApp.services'));

    // instantiate service
    var followService;
    var $httpBackend;

    beforeEach(inject(function (_$httpBackend_, _followService_) {
        followService = _followService_;
        $httpBackend = _$httpBackend_;
    }));

      it('should GET Followers from the server', function () {
        $httpBackend.expectGET('api/users/followers').respond(200, {"id": "55d1c1acddb6dabe468bbba1", "displayName": "Brand1", "pictrue": "path/to/picture"});

        var followers = followService.getFollowers();

        $httpBackend.flush();

        expect(followers).not.toBe(null);
    });
});