I have been working with jasmine unit testing like 2 months to test angularjs controllers and service. I found a issue when I try to instantiate another module of the app that have two array. I believe the issue is the oclazyload. Below you can see part of my module, the spec and the error. Please let me know what you you think I'm doing wrong.
Ex.
Part of my Module:
angular.module('myTest.contract', [[
"Scripts/lib/angular-datepicker/angular-datepicker.min.js",
"Scripts/lib/angular-datepicker/angular-datepicker.min.css",
"Scripts/lib/angular-wizard/angular-wizard.min.css",
"Scripts/lib/angular-wizard/angular-wizard.min.js",
"Scripts/lib/angular-tree/css/tree-control-attribute.css",
"Scripts/lib/angular-tree/angular-tree-control.js",
"Contract/Requisition/js/services/TestDataService.js",
"Contract/Requisition/js/services/TestsService.js"
],
"ngAnimate",
"ui.bootstrap",
"ui.router",
"angularUtils.directives.dirPagination",
"toaster",
"ncy-angular-breadcrumb",
"datePicker",
"uiSwitch",
"ng-currency",
"oc.lazyLoad",
"mgo-angular-wizard",
"treeControl"
])
.config([ '$stateProvider',function ($stateProvider) {
var $ocLazyLoad_,
$rootScope = {},
$controller;
beforeEach(angular.mock.module('myTest.contract'));
beforeEach(angular.mock.inject(function ($injector) {
// Set up the mock responses
$ocLazyLoad_ = $injector.get('$ocLazyLoad');
$rootScope = $injector.get('$rootScope');
$controller = $injector.get('$controller');
}));
it('ocLazyLoad should be defined', function () {
expect($ocLazyLoad_).toBeDefined();
});
)};
Error:
Error: [$injector:modulerr] Failed to instantiate module myTest.contract due to:
Error: [$injector:modulerr] Failed to instantiate module Contract/Requisition/js/services/TestsService.js.js due to:
Error: [ng:areq] Argument 'fn' is not a function, got string
I have been working with jasmine unit testing like 2 months to test angularjs controllers and service. I found a issue when I try to instantiate another module of the app that have two array. I believe the issue is the oclazyload. Below you can see part of my module, the spec and the error. Please let me know what you you think I'm doing wrong. Ex. Part of my Module: angular.module('myTest.contract', [[ "Scripts/lib/angular-datepicker/angular-datepicker.min.js", "Scripts/lib/angular-datepicker/angular-datepicker.min.css", "Scripts/lib/angular-wizard/angular-wizard.min.css", "Scripts/lib/angular-wizard/angular-wizard.min.js", "Scripts/lib/angular-tree/css/tree-control-attribute.css", "Scripts/lib/angular-tree/angular-tree-control.js", "Contract/Requisition/js/services/TestDataService.js", "Contract/Requisition/js/services/TestsService.js" ], "ngAnimate", "ui.bootstrap", "ui.router", "angularUtils.directives.dirPagination", "toaster", "ncy-angular-breadcrumb", "datePicker", "uiSwitch", "ng-currency", "oc.lazyLoad", "mgo-angular-wizard", "treeControl" ]) .config([ '$stateProvider',function ($stateProvider) {
Spec describe('Unit Testing Module myTest.contract ', function () { 'use strict';
)};
Error: Error: [$injector:modulerr] Failed to instantiate module myTest.contract due to: Error: [$injector:modulerr] Failed to instantiate module Contract/Requisition/js/services/TestsService.js.js due to: Error: [ng:areq] Argument 'fn' is not a function, got string