This is my AngularJs code, I would like to write a unit test which should call variables and functions inside the controller function.
For example, I would like to expect whether the abcCode is toBeDefined();
please let me know how to load the module and to call the properties inside the controller function (abcCodesCntrl). your suggestions would be really helpful. thanks
function () {
angular.module('abcapp',[])
.component('abcCodes', {
templateUrl: 'app/abcCodes/abcCodes.html',
controller: abcCodesCntrl
})
.config(function ($stateProvider) {
$stateProvider
.state('abcCodes', {
parent: 'home',
url: 'abcCodes',
template: '<abc-codes flex layout="column"></abc-codes>',
data: {
label: "abc Codes",
icon: 'business',
menu: true
}
});
});
/** @ngInject */
function abcCodesCntrl(F $state, abcCodeSvc, $scope, $mdDialog) {
var ctrl = this;
ctrl.abcCodes = [];
ctrl.loadingabcCodes = false;
} }