I'm actually stuck since few hours, my boss wants me to proceed to unit testing on the functionalities i coded last week, when I do my karma start karma.conf.js it gives me the following issue :
"message": "An error was thrown in afterAll\nUncaught ReferenceError: angular is not defined",
my files structure :
webapp
-www
-services
api.service.js
-test
test.test.js
karma.conf.js
essential of karma.conf.js :
module.exports = function(config) {
config.set({
files: [
'www/js/services/api.service.js',
'test/**/*.test.js'
],
})
}
I think Karma doesn't find my api.service.js but i don't know why, the angularjs code actually work in the webapp.
content of my test.test.js :
(function() {
'use strict';
describe('apiService', function() {
it('should return an array of object', function() {
var artist = typeof getArtist(118680); // MGMT Artist
console.log(artist);
expect(artist).toEqual('array');
});
});
})();
getArtist is the function I need to test situated in api.service.js.
Thank you,
Paul.