Получение ошибки $ controller не является функцией при выполнении модульного теста в Angular js - PullRequest
0 голосов
/ 22 января 2020

Я пишу тестовые случаи впервые. Я просто проверяю значение переменной области видимости. Но его подача ниже ошибки. Пожалуйста, помогите мне написать контрольные примеры для приведенного ниже файла контроллера, чтобы у меня была идея.

app. js file - у нас есть один модуль только для всего приложения

var app = angular.module('App',['angularjs-dropdown-multiselect','ngRoute', 'ngCookies', 
'ui.bootstrap', 'xeditable', 'ngAnimate', 'ngTabs','ngSanitize', 
'angularUtils.directives.dirPagination','angular-treeview','ui.select','angAccordion', 'ngStorage']);

Файл контроллера

app.controller('UserController',['$scope','IDGMainServices','UserServices', 
'ObjectManagementServices', '$location', '$timeout', '$cookies', '$cookieStore', '$window', '$http', 
'$sce', 'TooltipService', function ($scope, IDGMainServices, UserServices, ObjectManagementServices, 
$location, $timeout, $cookies, $cookieStore, $window, $http, $sce, TooltipService) {

$scope.tabs = IDGMainServices.tabs();

$scope.tabsService = IDGMainServices;
IDGMainServices.activeTab = 'admin' ; //$scope.tabs[8].id;
init();
function init() {
    $scope.username = $cookieStore.get("username"); 
    $scope.currentUser = $scope.username.split("@ad.xyz.com");
    $scope.configDataList = [] ; 
    $scope.Button = "Add";
    $scope.label = {
            addUserLabel :  true,
            addConfigLabel : true
    }
    $scope.btn = {
            resetButton : true
    }
    $scope.isDisabled = {
            username : false,
            emailId: false,
            password:false,
            role : false,
            group : false
    }
    $scope.users = {
            username : "",
            emailId: "",
            password:"",
            confirmPassword:"",
            role : "",
            group : ""
    };
    $scope.demo = {
            demo_id : "",
            metadataSchema : "",
            demoArr : [],
            metaSchemas : []
    };

    $scope.lineage = {
        db : "graph.db" ,
        save_wait : false 
    };

    $scope.config = {
            configDataId:"",
            configName : "",
            configValue: "",
            configDisplay:"",
            defaultFlag:"",
            demoId : "",
            addnInfo : ""
    };
}

$scope.usersOptions = {
        roles : [],
};

$scope.groupOptions = {
        groups : [],
};

$scope.userSearchFields = {
        mailId : "",
        role : "",
        group : "",
};

$scope.auditSearchFields = {
        loginId : "",
        module : "",
        comment : "",
        created_date: "" 
};

$scope.auditLoginSearchFields = {
        loginId : "",
        login_date : "",
        loginStatus : "",
        comment : "",
        created_date: "" 
};

$scope.Alerts = [];

$scope.addAlert = function(type, msg) {
    $scope.Alerts.push({
        type : type,
        msg : msg
    });
};

$scope.closeAlert = function(index) {
    $scope.Alerts.splice(index, 1);
};

$scope.initRoles = function() {
    UserServices.getRoles().then(function(data) {
        $scope.usersOptions.roles = data.RoleDetails;
    }, function(error) {
        console.log(error);
    });
};

$scope.initGroups = function() {
    UserServices.getGroups().then(function(data) {
        $scope.groupOptions.groups = data.GroupDetails;
    }, function(error) {
        console.log(error);
    });
};


$scope.loadUserListGrid = function() {
    $scope.users = {
            username : "",
            emailId: "",
            role : "",
            group : ""
    };
    $scope.userDataList = [];
    $scope.UserCurrentPage = 1;
    UserServices.getAllUserData().then(function(data) {
        if (data && data.UserDetails && data.UserDetails.length > 0) {
            $scope.userDataList = data.UserDetails;
        }
    }, function(error) {
        console.log(error);
    });
};

$scope.editUser = function(userObj) {
    $scope.users.userId = userObj.userId;
    $scope.users.username = userObj.mailId;
    $scope.users.emailId = userObj.emailId;
    $scope.users.password = userObj.password;
    $scope.users.confirmPassword = userObj.password;
    $scope.users.role = userObj.roleId.toString();
    $scope.users.group = userObj.groupId.toString();
    $scope.Button = "Update";
    $scope.isDisabled.password = true;
    $scope.btn.cancelButton= true;
    $scope.label = {
            addUserLabel : false,
            updateUserLabel : true,
            changePasswordLabel : false
    }
};

$scope.resetPassword = function(userObj) {
    $scope.users.userId = userObj.userId;
    $scope.users.username = userObj.mailId;
    $scope.users.emailId = userObj.emailId;
    $scope.users.password = "";
    $scope.users.confirmPassword = "";
    $scope.users.role = userObj.roleId.toString();
    $scope.users.group = userObj.groupId.toString();
    $scope.Button = "Save Password";
    $scope.btn = {
            cancelButton: true,
            resetButton : false
    }
    $scope.isDisabled = {
            username : true,
            emailId: true,
            password:false,
            role : true,
            group : true
    }
    $scope.label = {
            addUserLabel : false,
            updateUserLabel : false,
            changePasswordLabel : true
    }
};

$scope.deleteUser = function(userId,mailId) {
    var user = $cookieStore.get("username");
    var us = user.split("@");
    if(mailId.toUpperCase()  === us[0].toUpperCase() ){
        $window.alert("Cannot delete self");
        return ;
    }
        UserServices.deleteUser(userId,$cookieStore.get("username")).then(function(data) {
            if (data.deleteStatus === "Success") {
                $scope.addAlert("success", "User deleted successfully");
                // alert("Connection deleted successfully");
                $scope.loadUserListGrid();
            }
        }, function(error) {
            console.log(error);
            $scope.addAlert("danger", "Something went wrong while trying to delete User.");
            // alert("Something went wrong while trying to delete
            // template.");
        });
};

$scope.cancelUserData = function(){
    $scope.users.username = "";
    $scope.users.emailId = "";
    $scope.users.password = "";
    $scope.users.confirmPassword = "";
    $scope.users.role = "";
    $scope.users.group = "";
    $scope.isDisabled = {
            username : false,
            emailId: false,
            password:false,
            role : false,
            group : false
    }
    $scope.btn = {
            cancelButton: false,
            resetButton : true
    }
    $scope.Button = "Add";
    $scope.label = {
            addUserLabel : true,
            updateUserLabel : false
    }

}

$scope.resetUserData = function() {
    $scope.users.username = "";
    $scope.users.emailId = "";
    $scope.users.role = "";
    $scope.users.group = "";
    if($scope.Button === "Add") {
        $scope.users.password = "";
        $scope.users.confirmPassword = "";
    }
}

$scope.submitUserData = function(user) {
    var saveObj = {};
    Object.keys(user).map(function(k) {
        saveObj[k] = user[k];
        return k;
    });

    if($scope.Button === "Add") {
            UserServices.submitUserData(saveObj,$cookieStore.get("username")).then(function(response) {
                if (response.responsetype && response.responsetype === "Success") {
                    $scope.addAlert("success", "User Added successfully");
                } else if (response.data.responsetype === "Failure") {
                    $scope.addAlert("danger", response.data.message);
                }
                $scope.userDataList = [] ; 
                $scope.isDisabled.password= false;
                $scope.loadUserListGrid();
            }, function(error) {
                console.log(error);
            });
    } else if($scope.Button === "Update") {
    UserServices.updateUserData(saveObj,$cookieStore.get("username")).then(function(response) {
        if (response.responsetype && response.responsetype === "Success") {
            $scope.addAlert("success", "User Updated successfully");
            $scope.Button = "Add";
            $scope.isDisabled.password=false;
            $scope.btn.cancelButton= false;
            $scope.label = {
                    addUserLabel : true,
                    updateUserLabel : false
            }
            $scope.loadUserListGrid();
        } else if (response.data.responsetype === "Failure") {
            $scope.addAlert("danger", response.data.message);
        }
    }, function(error) {
        console.log(error);
    }); 
    }  else if($scope.Button === "Save Password") {
        if ($scope.users.password !== $scope.users.confirmPassword) {
            $scope.addAlert("danger", "Password does not match");
        } else {
        UserServices.updatePassword(saveObj,$cookieStore.get("username")).then(function(response) {
            if (response.responsetype && response.responsetype === "Success") {
                $scope.addAlert("success", "Password Updated successfully");
                $scope.Button = "Add";
                $scope.btn = {
                        cancelButton: false,
                        resetButton : true
                }
                $scope.isDisabled = {
                        username : false,
                        emailId: false,
                        password:false,
                        role : false,
                        group : false
                }
                $scope.label = {
                        addUserLabel : true,
                        updateUserLabel : false,
                        changePasswordLabel : false
                }
                $scope.loadUserListGrid();
            } else if (response.data.responsetype === "Failure") {
                $scope.addAlert("danger", response.data.message);
            }
        }, function(error) {
            console.log(error);
        })};    
    }
};

$scope.loadAuditReportGrid = function(){
    $scope.AuditReportResult = [];
    $scope.auditCurrentPage = 1;
    UserServices.getAuditReportData().then(function(data) {
        if (data && data.AuditReportDetails && data.AuditReportDetails.length > 0) {
            $scope.AuditReportResult = data.AuditReportDetails;
        }
    }, function(error) {
        console.log(error);
    });
}; 

$scope.loadLoginAuditReportGrid = function(){
    $scope.LoginAuditReportResult = [];
    $scope.auditLoginCurrentPage = 1;
    UserServices.getLoginAuditReportData().then(function(data) {
        if (data && data.LoginAuditReportDetails && data.LoginAuditReportDetails.length > 0) {
            $scope.LoginAuditReportResult = data.LoginAuditReportDetails;
        }
    }, function(error) {
        console.log(error);
    });
}; 

$scope.getMetaDataSchemaList = function(){
    UserServices.getMetaDataSchemaList().then(function(data) {
        if (data && data.Details) {
            $scope.demo.metaSchemas = data.Details.SchemaDetails;
            $scope.demo.demoArr = data.Details.DemoDetails;
            $scope.demo.ticketDetails = data.Details.TicketingDetails;
            $scope.demo.metaSchemas.forEach(function(d){
                if(d.ref_VALUE==='selected'){
                    $scope.demo.metadataSchema = d.ref_NAME;
                };
            });
            $scope.demo.demoArr.forEach(function(d){
                if(d.ref_VALUE==='selected'){
                    $scope.demo.demo_id = d.ref_NAME;
                };
            });
            $scope.demo.ticketDetails.forEach(function(d){
                if(d.ref_VALUE==='selected'){
                    $scope.demo.ticketTool = d.ref_NAME;
                };
            });
        }
    }, function(error) {
        console.log(error);
    });
};

$scope.setMetaSchema = function(){
    UserServices.setMetaSchema($scope.demo.demo_id,$scope.demo.metadataSchema).then(function(data) {
        $cookieStore.remove("demoId");
        $cookieStore.put("demoId", $scope.user.demoId, {
            expires : new Date(2020, 1, 1)
        });
        $scope.addAlert("success", "Demo Configuration set successfully");
    }, function(error) {
        console.log(error);
        $scope.addAlert("danger", "Something went wrong while trying to set config."+error);
    });
};

    $scope.setNeo4jSchema = function(){
    UserServices.setNeo4jSchema($scope.lineage,$cookieStore.get("username")).then(function(data) {
        console.log(data);
        if(data.Details == "Success"){
            $scope.addAlert("success", "Changed Neo4j DB name successfully");
        }
    }, function(error) {
        console.log(error);
        $scope.addAlert("danger", "Something went wrong while trying to change Neo4j DB name");
    });
};

$scope.setTicketingTool = function(){
    UserServices.setTicketingTool($scope.demo.ticketTool).then(function(data) {
        $scope.addAlert("success", "Ticketing Tool is set successfully");
    }, function(error) {
        console.log(error);
        $scope.addAlert("danger", "Something went wrong while trying to set Ticketing Tool."+error);
    });
};


$scope.createNeo4jDB = function(){
    var dbname={db:$scope.lineage.neo4jdbname, save_wait:false};
    /*UserServices.createNeo4jDB($scope.lineage.neo4jdbname).then(function(data) {
        $scope.addAlert("success", "Neo4j DB Created successfully");
    }, function(error) {
        console.log(error);
        $scope.addAlert("danger", "Something went wrong while trying to create Neo4j DB."+error);
    });*/
    UserServices.setNeo4jSchema(dbname,$cookieStore.get("username")).then(function(data) {
        if(data.Details == "Success"){
            $scope.addAlert("success", "Neo4j DB Created successfully");
        }
    }, function(error) {
        console.log(error);
        $scope.addAlert("danger", "Something went wrong while trying to create Neo4j DB");
    });
};

$scope.loadConfigDataGrid = function() {
    $scope.config = {
            configDataId:"",
            configName : "",
            configValue: "",
            configDisplay:"",
            defaultFlag:"",
            demoId : "",
            addnInfo : ""
    };
    $scope.configDataList = [];
    $scope.ConfigCurrentPage = 1;
    UserServices.getAllConfigData().then(function(data) {
        if (data && data.ConfigDetails && data.ConfigDetails.length > 0) {
            $scope.configDataList = data.ConfigDetails;
        }
    }, function(error) {
        console.log(error);
    });
};

$scope.initYesNoFlag = function() {
    UserServices.getFlag().then(function(data) {
        $scope.flagOptions = data.FlagDetails;
    }, function(error) {
        console.log(error);
    });
};

$scope.DemoId;
$scope.initDemoId = function() {
    UserServices.getDemoId().then(function(data) {
        $scope.DemoId= data.DemoIdDetails;
    }, function(error) {
        console.log(error);
    });
};

$scope.submitConfigData = function(config) {
    console.log($scope.Button);
    var saveObj = {};
    Object.keys(config).map(function(k) {
        saveObj[k] = config[k];
        return k;
    });

    if($scope.Button === "Add") {
             UserServices.submitConfigData(saveObj,$cookieStore.get("username")).then(function(response) {
                if (response.responsetype && response.responsetype === "Success") {
                    $scope.addAlert("success", "Configuration Added successfully");
                } else if (response.data.responsetype === "Failure") {
                    $scope.addAlert("danger", response.data.message);
                }
                $scope.configDataList = [] ; 
                $scope.loadConfigDataGrid();
            }, function(error) {
                console.log(error);
            });
    } else if($scope.Button === "Update") {
    UserServices.updateConfigData(saveObj,$cookieStore.get("username")).then(function(response) {
        if (response.responsetype && response.responsetype === "Success") {
            $scope.addAlert("success", "Configuration Updated successfully");
            $scope.Button = "Add";
            $scope.btn.cancelButton= false;
            $scope.label = {
                    addConfigLabel : true,
                    updateConfigLabel : false
            }
            $scope.loadConfigDataGrid();
        } else if (response.data.responsetype === "Failure") {
            $scope.addAlert("danger", response.data.message);
        }
    }, function(error) {
        console.log(error);
    }); 
    }
};

$scope.editConfigData = function(configObj) {
    $scope.config.configDataId = configObj.configDataId;
    $scope.config.configName = configObj.configName;
    $scope.config.configValue = configObj.configValue;
    $scope.config.configDisplay = configObj.configDisplay;
    $scope.config.defaultFlag = configObj.defaultFlag;
    $scope.config.demoId = configObj.demoId;
    $scope.config.addnInfo = configObj.addnInfo;
    $scope.Button = "Update";
    $scope.btn.cancelButton= true;
    $scope.label = {
            addConfigLabel : false,
            updateConfigLabel : true
    }
};

$scope.resetConfigData = function() {
    $scope.config = {
            configDataId:"",
            configName : "",
            configValue: "",
            configDisplay:"",
            defaultFlag:"",
            demoId : "",
            addnInfo : ""
    };
}

$scope.deleteConfigData = function(config) {
        UserServices.deleteConfigData(config.configDataId,$cookieStore.get("username")).then(function(data) {
            if (data.deleteStatus === "Success") {
                $scope.addAlert("success", "Configuration deleted successfully");
                $scope.loadConfigDataGrid();
            }
        }, function(error) {
            console.log(error);
            $scope.addAlert("danger", "Something went wrong while trying to delete the Configuration.");
        });
};

$scope.cancelConfigData = function(){
    $scope.config = {
            configDataId:"",
            configName : "",
            configValue: "",
            configDisplay:"",
            defaultFlag:"",
            demoId : "",
            addnInfo : ""
    };
    $scope.btn = {
            cancelButton: false,
            resetButton : true
    }
    $scope.Button = "Add";
    $scope.label = {
            addConfigLabel : true,
            updateConfigLabel : false
    }   
}

$scope.getNeo4jDBList = function() {
    UserServices.getNeo4jDBList().then(function(data) {
        if (data && data.Details) {
            $scope.neo4jDBList = data.Details.DB;

            $scope.neo4jDBList.forEach(function(d) {
                $scope.lineage.db = d.name;
            });

        }
    }, function(error) {
        console.log(error);
    });
};

}]);

файл тестовых примеров

describe('UserController', function() {
beforeEach(module('App'));

var $controller;

beforeEach(inject(function(_$controller_){
          $controller = _$controller_;
}));

describe('$scope.Button', function() {
    it('Check the scope object', function() {
        var $scope = {};
        var controller = $controller('UserController', { $scope: $scope });
        expect($scope.Button).toEqual('Add');
    });
});

});

Ошибка

  UserController
  $scope.Button
  × Check the scope object
    Error: [$injector:modulerr] Failed to instantiate module App due to:
    Error: [$injector:modulerr] Failed to instantiate module angularjs-dropdown-multiselect due to:
    Error: [$injector:nomod] Module 'angularjs-dropdown-multiselect' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.


    https://errors.angularjs.org/1.7.9/$injector/modulerr?p0=IDGApp&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20Failed%20to%20instantiate%20module%20angularjs-dropdown-multiselect%20due%20to%3A%0AError%3A%20%5B%24injector%3Anomod%5D%20Module%20'angularjs-dropdown-multiselect'%20is%20not%20available!%20You%20either%20misspelled%20the%20module%20name%20or%20forgot%20to%20load%20it.%20If%20registering%20a%20module%20ensure%20that%20you%20specify%20the%20dependencies%20as%20the%20second%20argument.%0A%0Ahttps%3A%2F%2Ferrors.angularjs.org%2F1.7.9%2F%24injector%2Fmodulerr%3Fp0%3Dangularjs-dropdown-multiselect%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520Module%2520'angularjs-dropdown-multiselect'%2520is%2520not%2520available!%2520You%2520either%2520misspelled%2520the%2520module%2520name%2520or%2520forgot%2520to%2520load%2520it.%2520If%2520registering%2520a%2520module%2520ensure%2520that%2520you%2520specify%2520the%2520dependencies%2520as%2520the%2520second%2520argument.%250Ahttps%253A%252F%252Ferrors.angularjs.org%252F1.7.9%252F%2524injector%252Fnomod%253Fp0%253Dangularjs-dropdown-multiselect%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A138%253A12%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A2310%253A17%250A%2520%2520%2520%2520at%2520ensure%2520(http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A2231%253A38)%250A%2520%2520%2520%2520at%2520module%2520(http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A2308%253A14)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A5038%253A22%250A%2520%2520%2520%2520at%2520forEach%2520(http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A387%253A20)%250A%2520%2520%2520%2520at%2520loadModules%2520(http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A5022%253A5)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A5040%253A40%250A%2520%2520%2520%2520at%2520forEach%2520(http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A387%253A20)%250A%2520%2520%2520%2520at%2520loadModules%2520(http%253A%252F%252Flocalhost%253A9876%252Fbase%252Fnode_modules%252Fangular%252Fangular.js%253F59efdd7db87c914e8c987ccc770455b4feb59f8f%253A5022%253A5)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A138%3A12%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A5062%3A15%0A%20%20%20%20at%20forEach%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A387%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A5022%3A5)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A5040%3A40%0A%20%20%20%20at%20forEach%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A387%3A20)%0A%20%20%20%20at%20loadModules%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A5022%3A5)%0A%20%20%20%20at%20Object.createInjector%20%5Bas%20injector%5D%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular%2Fangular.js%3F59efdd7db87c914e8c987ccc770455b4feb59f8f%3A4939%3A19)%0A%20%20%20%20at%20UserContext.WorkFn%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fangular-mocks%2Fangular-mocks.js%3Ff649c59bf3165c055fb0d3cba24f87813483baa9%3A3449%3A52)%0A%20%20%20%20at%20QueueRunner.attempt%20(http%3A%2F%2Flocalhost%3A9876%2Fbase%2Fnode_modules%2Fjasmine-core%2Flib%2Fjasmine-core%2Fjasmine.js%3Ffbc7eaf339ea249d8c912b258548d4e7b4dc180c%3A6365%3A44)
        at <Jasmine>
        at node_modules/angular/angular.js:138:12
        at node_modules/angular/angular.js:5062:15
        at forEach (node_modules/angular/angular.js:387:20)
        at loadModules (node_modules/angular/angular.js:5022:5)
        at Object.createInjector [as injector] (node_modules/angular/angular.js:4939:19)
        at UserContext.WorkFn (node_modules/angular-mocks/angular-mocks.js:3449:52)
        at <Jasmine>

    TypeError: $controller is not a function
        at <Jasmine>
        at UserContext.<anonymous> (tests/UserController.test.js:82:30)
        at <Jasmine>

Помогите мне написать примеры модульных тестов для этого файла.

...