Here is what I understood:
I did not load the 'angular -table' modules in the karma.conf.js file, so there is an error. This was intentional at first, as I wanted to test the "events" module without the actual table module.
I was able to easily make fun of the angular-table 'module by creating a new file in the test folder named "mocks / angular -table.js" and added the following code:
/ scoffing / angular -table.js
'use-strict'; angular.module('angular-table', []);
I added this file to my karma.conf.js file along with a real events module that I wanted to check:
karma.conf.js
... files = [ JASMINE, JASMINE_ADAPTER, 'scripts/libs/angular.js', 'scripts/libs/angular-mocks.js', 'scripts/events.js', // this is the real module. 'scripts/mocks/*.js', //loads all custom mocks. 'scripts/specs/*.spec.js' // loads my spec file. ] ...
Finally, in my spec file, I was able to add both modules by calling them separately in the beforeEach block:
specs / events.spec.js
beforeEach(function(){ module('angular-table'); module('events'); });
I got the idea to structure my files this way from this post
fscof Jul 09 '13 at 19:38 2013-07-09 19:38
source share