mercredi 26 août 2015

Unknown provider error Unit Testing AngularJS with Bard and Mocha?

So I'm getting this error when I'm running my Spec Runner for an AngularJS application.

Here's the picture

In my code, app settings is defined, and everything seems to be in the right place. No issues with these dependencies on the Live App.

Here's the app.core module

    (function () {
    'use strict';

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

        ]);
})();

And here's the aforementioned APP_SETTINGS file

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

    angular
        .module('settings')
        .constant('APP_SETTINGS', new (function() { // jshint ignore:line
            this.GODZILLA_URL = 'http://ift.tt/1NHU600';
            this.GODZILLA_EVENTS_URL = 'http://ift.tt/1NHU7RC';
            this.DOCUMENT_LINK = 'http://ift.tt/1KN4zBT';
            this.GEOSTPATIAL_URL = 'http://ift.tt/1NHU7RE';
            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
            };

        })());
})();

And here's the app module

 (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'

    ]);

})();

And here's the spec test file where it's stopping right at the beginning.

    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();
   });

Aucun commentaire:

Enregistrer un commentaire