Reputation: 1430
Controller test suite one (main controller):
describe("RTL cache viewing utility main controller test suite", function () {
var $rootScope, mainCtrl;
beforeEach(module('app'));
beforeEach(inject(function ($controller, $rootScope, $compile, $q) {
mainScope = $rootScope.$new();
ctrl = $controller('mainCtrl', {
$scope: mainScope
});
}));
followed by another describe and it
s. This one works fine.
Second test suite, for my modal controller:
describe("RTL cache viewing utility modal controller test suite", function () {
var $rootScope, modalController;
beforeEach(module('app'));
beforeEach(inject(function ($controller, $rootScope, $compile) {
mainScope = $rootScope.$new();
ctrl = $controller('modalController', {
$scope: mainScope
});
}));
followed by another describe and one it
.
Second controller throws this error: Error: [ng:areq] Argument 'modalController' is not a function, got undefined
Declarations for main controller :
var app = angular.module("app", ["agGrid", "ui.bootstrap"]);
angular.module("app").controller("mainCtrl", ["$scope", "$timeout", "dateFilter", "$http", "shareDataService", "getDataService", "$q", function ($scope, $timeout, dateFilter, $http, shareDataService, getDataService, $q) {
//stuff
}]);
modal controller :
angular.module("app").controller("modalCtrl", ["$scope", "shareDataService", "getDataService", function ($scope, shareDataService, ngDialog, getDataService) {
//stuff
}]);
Upvotes: 0
Views: 39
Reputation: 171679
You seem to have the names mixed up
Your controller is declared as modalCtrl
not modalController
that you are trying to use in test
Upvotes: 2