未知的提供程序错误单元测试AngularJS与Bard和Mocha?

时间:2015-08-26 13:37:55

标签: javascript angularjs unit-testing mocha bardjs

因此,当我为AngularJS应用程序运行Spec Runner时,我收到此错误。

Here's the picture

在我的代码中,定义了应用设置,一切似乎都在正确的位置。 Live App上的这些依赖项没有问题。

这是app.core模块

    (function () {
    'use strict';

    angular
        .module('app.core', [
            //'ngAnimate',
            'common.exception',
            'common.logger',
            'ui.router',
            'ngStorage',
            'xeditable',
            'ngSanitize'

        ]);
})();

以上是APP_SETTINGS文件

(function() {
    'use strict';
    angular.module('settings', []);

    angular
        .module('settings')
        .constant('APP_SETTINGS', new (function() { // jshint ignore:line
            this.GODZILLA_URL = 'http://node17.catapult.dev.boozallenet.com:8082/api/applications/godzilla/colap/count/';
            this.GODZILLA_EVENTS_URL = 'http://node17.catapult.dev.boozallenet.com:8082/api/applications/godzilla/colap/events/';
            this.DOCUMENT_LINK = 'http://node17.catapult.dev.boozallenet.com/Search/viewDetails/index/?itemId=';
            this.GEOSTPATIAL_URL = 'http://node17.catapult.dev.boozallenet.com:8083/api/v2/geospatial/';
            this.DS_SOURCE_NAME = "Auto-Tagged";
            this.DEFAULT_DELAY_INCREMENT_MILLI = 300;
            this.DEFAULT_DELAY_EXECUTE_MILLI = 700;
            this.DEFAULT_WIDGET_SIZES = {
                "chart": {
                    sizeX: 3,
                    sizeY: 12,
                    minSizeX: 3,
                    minSizeY: 10
                },
                "table": {
                    sizeX: 11,
                    sizeY: 22,
                    minSizeX: 3,
                    minSizeY: 15
                },
                "map": {
                    sizeX: 6,
                    sizeY: 12,
                    minSizeX: 2,
                    minSizeY: 2
                }
            };
            this.DATASOURCE_PROPERTIES = {
                "Auto-Tagged": {color: "#F15C80"}, //red
                "GLIDR": {color: "#7CB5EC"}, //blue
                "J9": {color: "#90ED7D"}, //green
                "CIDNE": {color: "#F7A35C"} //yellow
            };

        })());
})();

这是app模块

 (function () {
    'use strict';

    angular.module('app', [
        // App Modules
        'settings',
        'app.core',
        'app.navigation',
        'app.widgets',
        'app.workspace',
        'app.dslegend',
        'app.custompage',

        // Common Modules
        'common.utilities',
        'common.exception',
        'ngLodash',
        'ngSanitize'

    ]);

})();

这里是规范测试文件,它在开头就停止了。

    describe('DataService', function() {
    beforeEach(function() {
        bard.appModule('app.core');
        bard.inject('$httpBackend', '$q', '$rootScope', 'DataService', 'APP_SETTINGS');
    });

    //bard.verifyNoOutstandingHttpRequests();

    afterEach(function() {
     $httpBackend.verifyNoOutstandingExpectation();
     $httpBackend.verifyNoOutstandingRequest();
   });

0 个答案:

没有答案