lundi 28 mars 2016

My Module is not loading on jasmine testing

I was confused why am I getting the error : Module 'app.c0001App0 is not available! You either mispelled the module name or forgot tp load it while doing my testing in jasmine. Here's my code:

C0001Spec.js

describe('C0001Controller', function(){

var $scope,
    $rootScope,
    $injector,
    $controller,
    c0001controller;

beforeEach(module('app.c0001App'));
beforeEach(inject(function(_$rootScope_, _$injector_, _$controller_){
    $rootScope = _$rootScope_;
    $injector= _$injector_;
    $controller = _$controller_;
    $scope = $rootScope.$new();
    c0001controller = $controller('C0001Controller', {
        $scope : $scope
    });
}));

it("should use the Module", function(){
    expect(c0001controller).toBeDefined();
});

});

Karma.conf.js

    // list of files / patterns to load in the browser
files: [
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',


  'WebContent/js/controllers/*.js',
  'tests/*.js'
],

and the File needs to be tested C0001Ctrl.js:

angular.module('app.c0001App', [
'ui.router'

Aucun commentaire:

Enregistrer un commentaire