I have an angular module called 'widgets'. Here is it's signature being used in my app:
var app = angular.module('widgets', [
'widget.Panel',
'widget.List',
'services'
]);
I also have a controller being created off of app:
app.controller('clientListController', ['$scope', '$http', 'ServiceProvider', function ($scope, $http, ServiceProvider) {
I'm trying to write a unit test for 'clientListController'. Here is what I've done:
describe('clientListController', function () {
var ctrl, scope;
beforeEach(angular.module('widgets'));
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('clientListController', { $scope: scope });
}));
it("should define openClient function", function () {
expect(scope.openClient).toBeDefined();
});
});
When I try to run the tests, I get an error:
Error: Argument 'clientListController' is not a function, got undefined
Is there something wrong with how I've written the test? How come clientListController isn't defined? Does it have something to do with the dependencies?