4

I have defined a empty module in angular.js:

angular.module('todoList', [], function () {

})

then I want test it, in my conf.js, I load these javascript:

files = [
  JASMINE,
  JASMINE_ADAPTER,
  // lib
  '../js/lib/angular.min.js',
  '../js/lib/jquery-1.9.1.min.js',

  // our app
  '../js/project.js',

  // test file
  "test/*.js"
];

Then I want test it in test file:

describe('My own function', function(){
    beforeEach(module('todoList'));
});

but this step tell me

FAILED My own function encountered a declaration exception

I don't understand why just a load module sentence would cause wrong

How can I fix this problem?

dantheta
  • 1,107
  • 2
  • 13
  • 29
hh54188
  • 14,887
  • 32
  • 113
  • 184

1 Answers1

2

Try including angular-mocks.js in your config file.

Destron
  • 414
  • 2
  • 9
  • 1
    Yeah! Thank you very much! But why I need this file? – hh54188 Apr 02 '13 at 15:47
  • 1
    Mocks replace portions of code during testing to isolate each test. You use mocks by creating "stub" versions of inputs and responses. The angular-mocks file defines mock versions of angular's services necessary for testing. – Destron Apr 03 '13 at 16:28