jeudi 28 janvier 2016

Karm unit, unexpected request for GET template file

This probably has been asked a million times but somehow cant get it to work / cant find the answer to this issue. Hopefully someone can point me in the right direction.

Getting a unexpected GET on loading a template file. In previous projects i didn't explicitly had to specify a whenGET in the spec but in some examples I see people do this.

Did unit testing before without any problems, until now. I'm having the most basic setup which I'll post underneath.

The config file:

module.exports = function (config) {
    config.set({

        basePath: '',

        frameworks: ['jasmine'],

        files: [
            'app/bower_components/angular/angular.js',
            'app/bower_components/angular-mocks/angular-mocks.js',
            'app/bower_components/angular-resource/angular-resource.js',
            'app/bower_components/angular-sanitize/angular-sanitize.js',
            'app/bower_components/angular-route/angular-route.js',
            'app/bower_components/angular-foundation/mm-foundation-tpls.js',
            'app/bower_components/angular-bootstrap/ui-bootstrap.js',
            'app/bower_components/angular-infinite-scroll/src/infinite-scroll.js',
            'app/bower_components/ng-breadcrumbs/dist/ng-breadcrumbs.js',
            'app/bower_components/angular-touch/angular-touch.js',
            'app/bower_components/angular-elastic/elastic.js',
            'app/bower_components/angular-dynamic-locale/src/tmhDynamicLocale.js',
            'app/bower_components/angular-translate/angular-translate.js',
            'app/bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js',
            'app/bower_components/angular-scroll/angular-scroll.js',
            'app/bower_components/angular-ui-utils/ui-utils.js',
            'app/bower_components/venturocket-angular-slider/build/angular-slider.min.js',
            'app/bower_components/angular-recursion/angular-recursion.js',
            'app/bower_components/ngprogress/build/ngProgress.min.js',
            'app/scripts/**/*.js',
            'test/unit/*.js',
            'app/views/*.html'
        ],

        reporters: ['progress'],

        exclude: [],

        port: 8080,

        logLevel: config.LOG_INFO,

        autoWatch: false,

        browsers: ['Chrome'],

        singleRun: false,

        preprocessors: {
            'app/views/*.html': 'html2js'
        },

        ngHtml2JsPreprocessor: {
            moduleName: "templates"
        }
    });
};

the spec

   describe('LoginCtrl', function () {

    beforeEach(module('qubusApp'));

    var $httpBackend;

    beforeEach(inject(function ($rootScope, $injector) {
        var users = [{name: 'SJV'}, {name: 'Valk'}];
        $httpBackend = $injector.get('$httpBackend');
        //$httpBackend.whenGET('i18n/angular-locale_en.json').
        //respond(function () { return [200, users]; });
    }));

    it('should check for a string: hoi', inject(function ($controller) {

        var scope = {},
            ctrl = $controller('LoginCtrl', {$scope: scope});

        expect(scope.title).toBe('hoi');
    }));
});

Error msg

Error: Unexpected request: GET views/login.html No more request expected at $httpBackend (C:/Workspaces/projects/Q7Frontend/app/bow.............

Normally working on Mac, now Windows.. could be a path issue. No clue.

Question: can someone point me in the right direction?

Aucun commentaire:

Enregistrer un commentaire