I am currently working with an angular module named 'widgets'. In my app, I have used its signature as follows:
var app = angular.module('widgets', [
'widget.Panel',
'widget.List',
'services'
]);
In addition to this, I have created a controller from the app
variable:
app.controller('clientListController', ['$scope', '$http', 'ServiceProvider', function ($scope, $http, ServiceProvider) {
Now, I am attempting to write a unit test for the 'clientListController'. Here is what has been implemented so far:
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();
});
});
However, when running the tests, an error is encountered:
Error: Argument 'clientListController' is not a function, got undefined
I am puzzled as to why 'clientListController' is not being defined in the test. Could there be an issue with how the test is written or possibly related to the dependencies?