diff --git a/app/.htaccess b/app/.htaccess old mode 100755 new mode 100644 diff --git a/app/app.js b/app/app.js old mode 100755 new mode 100644 diff --git a/app/config/apiMapping.js b/app/config/apiMapping.js old mode 100755 new mode 100644 index 5d022ec..45ec0dc --- a/app/config/apiMapping.js +++ b/app/config/apiMapping.js @@ -55,59 +55,112 @@ var apiMapping = { 'method': 'update' } }, - VersionManagementSoftware: { + RemoteProjectManager: { validations: true, lazy: true, - channel: '/channel/version-management-software', + channel: '/channel/remote-project-manager', all: { 'endpoint': '/private/queue', - 'controller': 'version-management-software', + 'controller': 'remote-project-manager', 'method': '', 'httpMethod': 'GET' }, create: { 'endpoint': '/private/queue', - 'controller': 'version-management-software', + 'controller': 'remote-project-manager', 'method': '', 'httpMethod': 'POST' }, update: { 'endpoint': '/private/queue', - 'controller': 'version-management-software', + 'controller': 'remote-project-manager', 'method': '', 'httpMethod': 'PUT' }, remove: { 'endpoint': '/private/queue', - 'controller': 'version-management-software', + 'controller': 'remote-project-manager', 'method': '', 'httpMethod': 'DELETE' }, listen: { 'endpoint': '/channel', - 'controller': 'version-management-software' + 'controller': 'remote-project-manager' }, types: { 'endpoint': '/channel', - 'controller': 'version-management-software', + 'controller': 'remote-project-manager', 'method': 'types/', 'httpMethod': 'GET' }, scaffolding: { 'endpoint': '/channel', - 'controller': 'version-management-software', + 'controller': 'remote-project-manager', 'method': 'scaffolding/:type/', 'httpMethod': 'GET' } }, - VersionProject: { + Status: { + validations: true, + lazy: true, + channel: '/channel/status', all: { 'endpoint': '/private/queue', - 'controller': 'projects' + 'controller': 'status', + 'method': '', + 'httpMethod': 'GET' }, - getByScopeId: { + create: { 'endpoint': '/private/queue', - 'controller': 'projects' + 'controller': 'status', + 'method': '', + 'httpMethod': 'POST' + }, + update: { + 'endpoint': '/private/queue', + 'controller': 'status', + 'method': '', + 'httpMethod': 'PUT' + }, + remove: { + 'endpoint': '/private/queue', + 'controller': 'status', + 'method': '', + 'httpMethod': 'DELETE' + }, + listen: { + 'endpoint': '/channel', + 'controller': 'status' + } + }, + RemoteProjects: { + all: { + 'endpoint': '/private/queue', + 'controller': 'projects/remote' + }, + listen: { + 'endpoint': '/channel', + 'controller': 'projects/remote' + } + }, + ProjectsStats: { + all: { + 'endpoint': '/private/queue', + 'controller': 'projects/stats' + }, + listen: { + 'endpoint': '/channel', + 'controller': 'projects/stats' + } + }, + ActiveSprints: { + all: { + 'endpoint': '/private/queue', + 'controller': 'sprints/active' + }, + listen: { + 'endpoint': '/channel', + 'controller': 'sprints/active' } } }; \ No newline at end of file diff --git a/app/config/appConfig.js b/app/config/appConfig.js index fc5981b..aedcc7d 100644 --- a/app/config/appConfig.js +++ b/app/config/appConfig.js @@ -1,38 +1,39 @@ var appConfig = { - 'version': '1.0.0', + 'version': '1.0.0', - 'allowAnonymous': true, + 'allowAnonymous': true, - 'anonymousRole': 'ROLE_ANONYMOUS', + 'anonymousRole': 'ROLE_ANONYMOUS', - // Set this to the webService if mocking AuthService + // Set this to the webService if mocking AuthService - 'authService': 'https://labs.library.tamu.edu/auth3', - 'webService': 'http://localhost:9000', + 'authService': 'https://labs.library.tamu.edu/auth3', + 'webService': 'http://localhost:9001', - 'storageType': 'session', + 'storageType': 'session', - 'logging': { - 'log': true, - 'info': true, - 'warn': true, - 'error': true, - 'debug': true - }, + 'logging': { + 'log': true, + 'info': true, + 'warn': true, + 'error': true, + 'debug': true + }, - 'stompDebug': false, + 'stompDebug': false, - /* - Determines the type of connection stomp will attempt to make with the service. - TYPES: websocket, xhr-streaming, xdr-streaming, eventsource, iframe-eventsource, - htmlfile, iframe-htmlfile, xhr-polling, xdr-polling, iframe-xhr-polling, - jsonp-polling - */ - 'sockJsConnectionType': ['websocket', 'xhr-streaming', 'xhr-polling', 'xdr-streaming', 'xdr-polling', 'iframe-eventsource', 'iframe-htmlfile', 'jsonp-polling'], + /* + Determines the type of connection stomp will attempt to make with the service. + TYPES: websocket, xhr-streaming, xdr-streaming, eventsource, iframe-eventsource, + htmlfile, iframe-htmlfile, xhr-polling, xdr-polling, iframe-xhr-polling, + jsonp-polling + */ + 'sockJsConnectionType': ['websocket', 'xhr-streaming', 'xhr-polling', 'xdr-streaming', 'xdr-polling', 'iframe-eventsource', 'iframe-htmlfile', 'jsonp-polling'], - // Set this to 'admin' or 'user' if using mock AuthService - // otherwise set to null or false + // Set this to 'admin' or 'user' if using mock AuthService + // otherwise set to null or false - 'mockRole': null -}; + 'mockRole': null + +}; \ No newline at end of file diff --git a/app/config/routes.js b/app/config/routes.js old mode 100755 new mode 100644 index 31dcd15..4510ddc --- a/app/config/routes.js +++ b/app/config/routes.js @@ -1,17 +1,12 @@ app.config(function ($routeProvider) { $routeProvider. when('/management', { - redirectTo: '/management/projects', - access: ["ROLE_ADMIN", "ROLE_MANGER"] + redirectTo: '/management/projects' }). when('/management/:tab', { templateUrl: 'views/management.html', access: ["ROLE_ADMIN", "ROLE_MANGER"] }). - when('/projects', { - templateUrl: '/views/management/projects.html', - access: ["ROLE_ADMIN", "ROLE_MANGER"] - }). when('/home', { redirectTo: '/' }). diff --git a/app/config/runTime.js b/app/config/runTime.js old mode 100755 new mode 100644 diff --git a/app/controllers/activeSprintsController.js b/app/controllers/activeSprintsController.js new file mode 100644 index 0000000..f10a389 --- /dev/null +++ b/app/controllers/activeSprintsController.js @@ -0,0 +1,69 @@ +app.controller('ActiveSprintsController', function ($controller, $sce, $scope, ActiveSprintsService, StatusRepo) { + + angular.extend(this, $controller('AbstractController', { + $scope: $scope + })); + + if (sessionStorage.selected === undefined) { + sessionStorage.selected = 0; + } + + var trusted = {}; + + $scope.statuses = StatusRepo.getAll(); + + $scope.activeSprints = ActiveSprintsService.getActiveSprints(); + + $scope.select = function (index) { + sessionStorage.selected = index; + }; + + $scope.kanbanHeader = function () { + return $scope.getSelectedSprint() ? $scope.getSelectedSprint().project + ": " + $scope.getSelectedSprint().name : "Select Sprint Above"; + }; + + $scope.getSprintEstimateTotal = function (sprint) { + var total = 0; + for (var i in sprint.cards) { + var card = sprint.cards[i]; + if (card.estimate) { + total += card.estimate; + } + } + return total; + }; + + $scope.getStatusEstimateTotal = function (status) { + var total = 0; + var sprint = $scope.getSelectedSprint(); + for (var i in sprint.cards) { + var card = sprint.cards[i]; + if (card.status === status.identifier && card.estimate) { + total += card.estimate; + } + } + return total; + }; + + $scope.getAvatarUrl = function (assignee) { + return appConfig.webService + "/images/" + assignee.avatar; + }; + + $scope.getHtmlContent = function (content) { + return trusted[content] || (trusted[content] = $sce.trustAsHtml(content)); + }; + + $scope.getSelectedSprint = function () { + return $scope.activeSprints.length > 0 ? $scope.activeSprints[sessionStorage.selected] : undefined; + }; + + ActiveSprintsService.updated.then(null, null, function () { + if ($scope.activeSprints.length > 0) { + while (sessionStorage.selected >= $scope.activeSprints.length) { + sessionStorage.selected--; + } + $scope.select(sessionStorage.selected); + } + }); + +}); \ No newline at end of file diff --git a/app/controllers/managementController.js b/app/controllers/managementController.js deleted file mode 100644 index 6b96b37..0000000 --- a/app/controllers/managementController.js +++ /dev/null @@ -1,7 +0,0 @@ -app.controller('ManagementController', function ($controller, $scope) { - - angular.extend(this, $controller('AbstractController', { - $scope: $scope - })); - -}); \ No newline at end of file diff --git a/app/controllers/projectController.js b/app/controllers/projectController.js index b0392c4..e37d08c 100644 --- a/app/controllers/projectController.js +++ b/app/controllers/projectController.js @@ -1,11 +1,9 @@ -app.controller('ProjectController', function ($controller, $scope, $rootScope, NgTableParams, ApiResponseActions, Project, ProjectRepo, VersionManagementSoftwareRepo, VersionProjectService) { +app.controller('ProjectController', function ($controller, $scope, ApiResponseActions, ProjectRepo, RemoteProjectManagerRepo, RemoteProjectsService) { angular.extend(this, $controller('AbstractController', { $scope: $scope })); - $scope.vmses = VersionManagementSoftwareRepo.getAll(); - $scope.projects = ProjectRepo.getAll(); $scope.projectToCreate = ProjectRepo.getScaffold(); @@ -32,12 +30,12 @@ app.controller('ProjectController', function ($controller, $scope, $rootScope, N $scope.createProject = function () { ProjectRepo.create($scope.projectToCreate).then(function (res) { if (angular.fromJson(res.body).meta.status === 'SUCCESS') { - $scope.cancelCreateProject(); + $scope.resetCreateProject(); } }); }; - $scope.cancelCreateProject = function () { + $scope.resetCreateProject = function () { angular.extend($scope.projectToCreate, ProjectRepo.getScaffold()); $scope.resetProjectForms(); }; @@ -78,64 +76,30 @@ app.controller('ProjectController', function ($controller, $scope, $rootScope, N }); }; - var buildTable = function () { - var allProjects = ProjectRepo.getAll(); - $scope.tableParams = new NgTableParams({ - count: allProjects.length, - sorting: { - name: 'asc' - } - }, { - counts: [], - total: 0, - getData: function (params) { - return $scope.projects; - } - }); - }; + if ($scope.isManager() || $scope.isAdmin()) { + $scope.remoteProjectManagers = RemoteProjectManagerRepo.getAll(); - $scope.vmsVersionProjects = {}; + $scope.remoteProjects = RemoteProjectsService.getRemoteProjects(); - var getVmsById = function (id) { - VersionProjectService.getAll(id).then(function (versionProjects) { - $scope.vmsVersionProjects[id] = versionProjects; - }); - }; + $scope.getRemoteProjectManagerRemoteProjects = function (remoteProjectManagerId) { + return $scope.remoteProjects[remoteProjectManagerId]; + }; - VersionManagementSoftwareRepo.ready().then(function () { - for (var i in $scope.vmses) { - if (i !== 'visibleColumnCount') { - getVmsById($scope.vmses[i].id); + RemoteProjectManagerRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.remoteProjectManagers.length = 0; + var remoteProjectManagers = RemoteProjectManagerRepo.getAll(); + for (var i in remoteProjectManagers) { + $scope.remoteProjectManagers.push(remoteProjectManagers[i]); } - } - }); - - $scope.getVmsVersionProjects = function (vmsId) { - return $scope.vmsVersionProjects[vmsId]; - }; - - $scope.getVmsVersionProjects = function (vmsId) { - return $scope.vmsVersionProjects[vmsId]; - }; + }); + } - $scope.getVersionProject = function (project) { - if (project.scopeId && project.versionManagementSoftware && !project.versionProject) { - project.versionProject = {}; - VersionProjectService.getByScopeId(project.versionManagementSoftware.id, project.scopeId).then(function (versionProject) { - angular.extend(project, { - versionProject: versionProject - }); - }); + ProjectRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.projects.length = 0; + var projects = ProjectRepo.getAll(); + for (var i in projects) { + $scope.projects.push(projects[i]); } - return project.versionProject; - }; - - ProjectRepo.ready().then(function () { - buildTable(); - }); - - ProjectRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function (arg) { - buildTable(); }); }); \ No newline at end of file diff --git a/app/controllers/remoteProjectManagerController.js b/app/controllers/remoteProjectManagerController.js new file mode 100644 index 0000000..affc44a --- /dev/null +++ b/app/controllers/remoteProjectManagerController.js @@ -0,0 +1,101 @@ +app.controller('RemoteProjectManagerController', function ($controller, $scope, ApiResponseActions, RemoteProjectManagerRepo) { + + angular.extend(this, $controller('AbstractController', { + $scope: $scope + })); + + $scope.remoteProjectManagers = RemoteProjectManagerRepo.getAll(); + + $scope.remoteProjectManagerToCreate = RemoteProjectManagerRepo.getScaffold(); + + $scope.remoteProjectManagerToEdit = {}; + $scope.remoteProjectManagerToDelete = {}; + + RemoteProjectManagerRepo.getTypes().then(function (types) { + $scope.serviceTypes = types; + $scope.resetRemoteProjectManagerForms(); + }); + + $scope.remoteProjectManagerForms = { + validations: RemoteProjectManagerRepo.getValidations(), + getResults: RemoteProjectManagerRepo.getValidationResults + }; + + $scope.resetRemoteProjectManagerForms = function () { + RemoteProjectManagerRepo.clearValidationResults(); + for (var key in $scope.remoteProjectManagerForms) { + if ($scope.remoteProjectManagerForms[key] !== undefined && !$scope.remoteProjectManagerForms[key].$pristine && $scope.remoteProjectManagerForms[key].$setPristine) { + $scope.remoteProjectManagerForms[key].$setPristine(); + } + } + $scope.closeModal(); + }; + + $scope.createRemoteProjectManager = function () { + RemoteProjectManagerRepo.create($scope.remoteProjectManagerToCreate).then(function (res) { + if (angular.fromJson(res.body).meta.status === 'SUCCESS') { + $scope.resetCreateRemoteProjectManager(); + } + }); + }; + + $scope.resetCreateRemoteProjectManager = function () { + $scope.remoteProjectManagerToCreate = RemoteProjectManagerRepo.getScaffold(); + $scope.resetRemoteProjectManagerForms(); + }; + + $scope.editRemoteProjectManager = function (remoteProjectManager) { + $scope.remoteProjectManagerToEdit = angular.copy(remoteProjectManager); + $scope.openModal('#editRemoteProjectManagerModal'); + }; + + $scope.updateRemoteProjectManager = function () { + $scope.remoteProjectManagerToEdit.dirty(true); + $scope.remoteProjectManagerToEdit.save().then(function (res) { + if (angular.fromJson(res.body).meta.status === "SUCCESS") { + $scope.cancelEditRemoteProjectManager(); + } + }); + }; + + $scope.cancelEditRemoteProjectManager = function () { + $scope.remoteProjectManagerToEdit.refresh(); + $scope.resetRemoteProjectManagerForms(); + }; + + $scope.confirmDeleteRemoteProjectManager = function (remoteProjectManager) { + $scope.remoteProjectManagerToDelete = remoteProjectManager; + $scope.openModal('#deleteRemoteProjectManagerModal'); + }; + + $scope.cancelDeleteRemoteProjectManager = function () { + $scope.remoteProjectManagerToDelete = {}; + $scope.closeModal(); + }; + + $scope.deleteRemoteProjectManager = function (remoteProjectManager) { + RemoteProjectManagerRepo.delete(remoteProjectManager).then(function (res) { + if (angular.fromJson(res.body).meta.status === 'SUCCESS') { + $scope.cancelDeleteRemoteProjectManager(); + } + }); + }; + + $scope.typeSettings = function (type) { + for (var i in $scope.serviceTypes) { + if ($scope.serviceTypes[i].value === type) { + return $scope.serviceTypes[i].scaffold; + } + } + return []; + }; + + RemoteProjectManagerRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.remoteProjectManagers.length = 0; + var remoteProjectManagers = RemoteProjectManagerRepo.getAll(); + for (var i in remoteProjectManagers) { + $scope.remoteProjectManagers.push(remoteProjectManagers[i]); + } + }); + +}); \ No newline at end of file diff --git a/app/controllers/statusController.js b/app/controllers/statusController.js new file mode 100644 index 0000000..2a326fa --- /dev/null +++ b/app/controllers/statusController.js @@ -0,0 +1,110 @@ +app.controller('StatusController', function ($controller, $scope, ApiResponseActions, StatusRepo) { + + angular.extend(this, $controller('AbstractController', { + $scope: $scope + })); + + $scope.statuses = StatusRepo.getAll(); + + $scope.statusToCreate = StatusRepo.getScaffold(); + + $scope.statusToDelete = {}; + + $scope.statusForms = { + validations: StatusRepo.getValidations(), + getResults: StatusRepo.getValidationResults + }; + + $scope.resetStatusForms = function () { + StatusRepo.clearValidationResults(); + for (var key in $scope.statusForms) { + if ($scope.statusForms[key] !== undefined && !$scope.statusForms[key].$pristine && $scope.statusForms[key].$setPristine) { + $scope.statusForms[key].$setPristine(); + } + } + $scope.closeModal(); + }; + + $scope.resetStatusForms(); + + $scope.createStatus = function () { + sanatizeMapping($scope.statusToCreate); + StatusRepo.create($scope.statusToCreate).then(function (res) { + if (angular.fromJson(res.body).meta.status === 'SUCCESS') { + $scope.resetCreateStatus(); + } + }); + }; + + $scope.resetCreateStatus = function () { + angular.extend($scope.statusToCreate, StatusRepo.getScaffold()); + $scope.resetStatusForms(); + }; + + $scope.editStatus = function (status) { + $scope.statusToEdit = status; + if ($scope.statusToEdit.mapping.length === 0) { + $scope.statusToEdit.mapping.push(''); + } + $scope.openModal('#editStatusModal'); + }; + + $scope.updateStatus = function () { + sanatizeMapping($scope.statusToEdit); + $scope.statusToEdit.dirty(true); + $scope.statusToEdit.save().then(function (res) { + if (angular.fromJson(res.body).meta.status === "SUCCESS") { + $scope.cancelEditStatus(); + } + }); + }; + + $scope.addMatch = function (status) { + status.mapping.push(''); + }; + + $scope.removeMatch = function (status, index) { + status.mapping.splice(index, 1); + }; + + $scope.cancelEditStatus = function () { + $scope.statusToEdit.refresh(); + $scope.statusToEdit = {}; + $scope.resetStatusForms(); + }; + + $scope.confirmDeleteStatus = function (status) { + $scope.statusToDelete = status; + $scope.openModal('#deleteStatusModal'); + }; + + $scope.cancelDeleteStatus = function () { + $scope.statusToDelete = {}; + $scope.closeModal(); + }; + + $scope.deleteStatus = function (status) { + StatusRepo.delete(status).then(function (res) { + if (angular.fromJson(res.body).meta.status === "SUCCESS") { + $scope.cancelDeleteStatus(); + } + }); + }; + + var sanatizeMapping = function (status) { + for (var i = status.mapping.length - 1; i >= 0; i--) { + if (status.mapping[i].trim().length === 0) { + status.mapping.splice(i, 1); + } + } + }; + + StatusRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.statuses.length = 0; + var statuses = StatusRepo.getAll(); + for (var i in statuses) { + $scope.statuses.push(statuses[i]); + } + }); + +}); \ No newline at end of file diff --git a/app/controllers/userRepoController.js b/app/controllers/userRepoController.js old mode 100755 new mode 100644 diff --git a/app/controllers/versionManagementSoftwareController.js b/app/controllers/versionManagementSoftwareController.js deleted file mode 100644 index 3f0a6f1..0000000 --- a/app/controllers/versionManagementSoftwareController.js +++ /dev/null @@ -1,116 +0,0 @@ -app.controller('VersionManagementSoftwareController', function ($controller, $scope, $filter, $rootScope, ApiResponseActions, NgTableParams, VersionManagementSoftware, VersionManagementSoftwareRepo) { - - angular.extend(this, $controller('AbstractController', { - $scope: $scope - })); - - $scope.vmses = VersionManagementSoftwareRepo.getAll(); - - $scope.vmsToCreate = VersionManagementSoftwareRepo.getScaffold(); - - $scope.vmsToEdit = {}; - $scope.vmsToDelete = {}; - - VersionManagementSoftwareRepo.getTypes().then(function (types) { - $scope.serviceTypes = types; - }); - - $scope.vmsForms = { - validations: VersionManagementSoftwareRepo.getValidations(), - getResults: VersionManagementSoftwareRepo.getValidationResults - }; - - $scope.resetVmsForms = function () { - VersionManagementSoftwareRepo.clearValidationResults(); - for (var key in $scope.vmsForms) { - if ($scope.vmsForms[key] !== undefined && !$scope.vmsForms[key].$pristine && $scope.vmsForms[key].$setPristine) { - $scope.vmsForms[key].$setPristine(); - } - } - $scope.closeModal(); - }; - - $scope.resetVmsForms(); - - $scope.createVms = function () { - VersionManagementSoftwareRepo.create($scope.vmsToCreate).then(function (res) { - if (angular.fromJson(res.body).meta.status === 'SUCCESS') { - $scope.cancelCreateVms(); - } - }); - }; - - $scope.cancelCreateVms = function () { - $scope.vmsToCreate = VersionManagementSoftwareRepo.getScaffold(); - $scope.resetVmsForms(); - }; - - $scope.editVms = function (vms) { - $scope.vmsToEdit = angular.copy(vms); - $scope.openModal('#editVmsModal'); - }; - - $scope.updateVms = function () { - $scope.vmsToEdit.dirty(true); - $scope.vmsToEdit.save().then(function () { - $scope.cancelEditVms(); - }); - }; - - $scope.cancelEditVms = function () { - $scope.vmsToEdit.refresh(); - $scope.resetVmsForms(); - }; - - $scope.confirmDeleteVms = function (vms) { - $scope.vmsToDelete = vms; - $scope.openModal('#deleteVmsModal'); - }; - - $scope.cancelDeleteVms = function () { - $scope.vmsToDelete = {}; - $scope.closeModal(); - }; - - $scope.deleteVms = function (vms) { - VersionManagementSoftwareRepo.delete(vms).then(function (res) { - if (angular.fromJson(res.body).meta.status === 'SUCCESS') { - $scope.cancelDeleteVms(); - } - }); - }; - - $scope.typeSettings = function (type) { - for (var i in $scope.serviceTypes) { - if ($scope.serviceTypes[i].value === type) { - return $scope.serviceTypes[i].scaffold; - } - } - return []; - }; - - var buildTable = function () { - var allVmses = VersionManagementSoftwareRepo.getAll(); - $scope.tableParams = new NgTableParams({ - count: allVmses.length, - sorting: { - name: 'ASC' - } - }, { - counts: [], - total: 0, - getData: function (params) { - return $scope.vmses; - } - }); - }; - - VersionManagementSoftwareRepo.ready().then(function () { - buildTable(); - }); - - VersionManagementSoftwareRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function (arg) { - buildTable(); - }); - -}); \ No newline at end of file diff --git a/app/directives/remoteProjectManagerFormDirective.js b/app/directives/remoteProjectManagerFormDirective.js new file mode 100644 index 0000000..7cdf011 --- /dev/null +++ b/app/directives/remoteProjectManagerFormDirective.js @@ -0,0 +1,58 @@ +app.directive('remoteProjectManagerForm', function () { + return { + templateUrl: 'views/directives/remoteProjectManagerForm.html', + restrict: 'E', + replace: false, + scope: { + 'managementSettings': '=', + 'model': '=' + }, + link: function ($scope) { + + var isAuthRequired = function () { + for (var i in $scope.managementSettings) { + var key = $scope.managementSettings[i].key; + if (key === 'password' || key === 'token') { + return true; + } + } + }; + + var hasToken = function () { + for (var key in $scope.model.settings) { + var value = $scope.model.settings[key]; + if (key === 'token' && value !== undefined && value.length > 0) { + return true; + } + } + }; + + $scope.auth = { + useToken: hasToken(), + required: isAuthRequired() + }; + + $scope.inputSetting = function (setting) { + var display = true; + if ($scope.auth.useToken) { + if (setting.key === 'username' || setting.key === 'password') { + display = false; + } + } else { + if (setting.key === 'token') { + display = false; + } + } + return display; + }; + + $scope.clearAuthSettings = function () { + for (var key in $scope.model.settings) { + if (key === 'token' || key === 'username' || key === 'password') { + $scope.model.settings[key] = ''; + } + } + }; + } + }; +}); \ No newline at end of file diff --git a/app/directives/vmsFormDirective.js b/app/directives/vmsFormDirective.js deleted file mode 100644 index 08d6715..0000000 --- a/app/directives/vmsFormDirective.js +++ /dev/null @@ -1,12 +0,0 @@ -app.directive('vmsForm', function () { - return { - templateUrl: 'views/directives/vmsForm.html', - restrict: 'E', - replace: false, - scope: { - 'managementSettings': '=', - 'model': '=' - }, - link: function ($scope) {} - }; -}); \ No newline at end of file diff --git a/app/index.html b/app/index.html old mode 100755 new mode 100644 index 3545ec7..da3defd --- a/app/index.html +++ b/app/index.html @@ -46,9 +46,9 @@
-
-
+
+
-
+
@@ -195,10 +195,12 @@ - + - + + + @@ -208,18 +210,21 @@ - + + - + + - + - + + diff --git a/app/model/abstractAppModel.js b/app/model/abstractAppModel.js old mode 100755 new mode 100644 diff --git a/app/model/project.js b/app/model/project.js index 5b557d5..88755e9 100644 --- a/app/model/project.js +++ b/app/model/project.js @@ -1,5 +1,28 @@ -app.model("Project", function Project() { +app.model("Project", function Project(ProjectsStatsService, RemoteProjectsService) { return function Project() { - return this; + + var project = this; + + project.before(function () { + if (project.remoteProjectManager && project.scopeId) { + ProjectsStatsService.getById(project.id).then(function (projectStats) { + angular.extend(project, { + stats: projectStats + }); + }); + } + }); + + project.before(function () { + if (project.remoteProjectManager && project.scopeId) { + RemoteProjectsService.getByScopeId(project.remoteProjectManager.id, project.scopeId).then(function (remoteProject) { + angular.extend(project, { + remoteProject: remoteProject + }); + }); + } + }); + + return project; }; }); \ No newline at end of file diff --git a/app/model/remoteProjectManager.js b/app/model/remoteProjectManager.js new file mode 100644 index 0000000..694a7c6 --- /dev/null +++ b/app/model/remoteProjectManager.js @@ -0,0 +1,5 @@ +app.model("RemoteProjectManager", function RemoteProjectManager() { + return function RemoteProjectManager() { + return this; + }; +}); \ No newline at end of file diff --git a/app/model/status.js b/app/model/status.js new file mode 100644 index 0000000..4ea8bb9 --- /dev/null +++ b/app/model/status.js @@ -0,0 +1,5 @@ +app.model("Status", function Status() { + return function Status() { + return this; + }; +}); \ No newline at end of file diff --git a/app/model/versionManagementSoftware.js b/app/model/versionManagementSoftware.js deleted file mode 100644 index 0457333..0000000 --- a/app/model/versionManagementSoftware.js +++ /dev/null @@ -1,5 +0,0 @@ -app.model("VersionManagementSoftware", function VersionManagementSoftware() { - return function VersionManagementSoftware() { - return this; - }; -}); \ No newline at end of file diff --git a/app/repo/abstractAppRepo.js b/app/repo/abstractAppRepo.js old mode 100755 new mode 100644 index a8c63a0..d152c8c --- a/app/repo/abstractAppRepo.js +++ b/app/repo/abstractAppRepo.js @@ -1,4 +1,4 @@ -app.service("AbstractAppRepo", function () { +app.service("AbstractAppRepo", function AbstractAppRepo() { return function AbstractAppRepo() { diff --git a/app/repo/versionManagementSoftwareRepo.js b/app/repo/remoteProjectManagerRepo.js similarity index 77% rename from app/repo/versionManagementSoftwareRepo.js rename to app/repo/remoteProjectManagerRepo.js index 37defa4..3819d51 100644 --- a/app/repo/versionManagementSoftwareRepo.js +++ b/app/repo/remoteProjectManagerRepo.js @@ -1,42 +1,42 @@ -app.repo("VersionManagementSoftwareRepo", function VersionManagementSoftwareRepo($q, WsApi) { - - this.scaffold = { - name: '', - type: '' - }; - - this.getTypes = function () { - return $q(function (resolve, reject) { - WsApi.fetch(apiMapping.VersionManagementSoftware.types).then(function (res) { - var apiRes = angular.fromJson(res.body); - if (apiRes.meta.status === 'SUCCESS') { - resolve(apiRes.payload['ArrayList']); - } else { - reject(); - } - }); - }); - }; - - this.getTypeScaffolding = function (type) { - return $q(function (resolve, reject) { - if (type !== undefined) { - WsApi.fetch(apiMapping.VersionManagementSoftware.scaffolding, { - pathValues: { - type: type - } - }).then(function (res) { - var apiRes = angular.fromJson(res.body); - if (apiRes.meta.status === 'SUCCESS') { - resolve(apiRes.payload['ArrayList']); - } else { - reject(); - } - }); - } - }); - }; - - return this; - +app.repo("RemoteProjectManagerRepo", function RemoteProjectManagerRepo($q, WsApi) { + + this.scaffold = { + name: '', + type: '' + }; + + this.getTypes = function () { + return $q(function (resolve, reject) { + WsApi.fetch(apiMapping.RemoteProjectManager.types).then(function (res) { + var apiRes = angular.fromJson(res.body); + if (apiRes.meta.status === 'SUCCESS') { + resolve(apiRes.payload['ArrayList']); + } else { + reject(); + } + }); + }); + }; + + this.getTypeScaffolding = function (type) { + return $q(function (resolve, reject) { + if (type !== undefined) { + WsApi.fetch(apiMapping.RemoteProjectManager.scaffolding, { + pathValues: { + type: type + } + }).then(function (res) { + var apiRes = angular.fromJson(res.body); + if (apiRes.meta.status === 'SUCCESS') { + resolve(apiRes.payload['ArrayList']); + } else { + reject(); + } + }); + } + }); + }; + + return this; + }); \ No newline at end of file diff --git a/app/repo/statusRepo.js b/app/repo/statusRepo.js new file mode 100644 index 0000000..5453c65 --- /dev/null +++ b/app/repo/statusRepo.js @@ -0,0 +1,9 @@ +app.repo("StatusRepo", function StatusRepo() { + + this.scaffold = { + identifier: '', + mapping: [''] + }; + + return this; +}); \ No newline at end of file diff --git a/app/repo/userRepo.js b/app/repo/userRepo.js old mode 100755 new mode 100644 diff --git a/app/resources/images/ajax-loader.gif b/app/resources/images/ajax-loader.gif old mode 100755 new mode 100644 diff --git a/app/resources/images/favicon.ico b/app/resources/images/favicon.ico old mode 100755 new mode 100644 diff --git a/app/resources/images/loading.gif b/app/resources/images/loading.gif old mode 100755 new mode 100644 diff --git a/app/resources/styles/sass/app.scss b/app/resources/styles/sass/app.scss old mode 100755 new mode 100644 index fded0ff..fee6b65 --- a/app/resources/styles/sass/app.scss +++ b/app/resources/styles/sass/app.scss @@ -6,6 +6,7 @@ $linkColor: #337ab7; @import "node_modules/weaver-ui-core/app/resources/styles/sass/main"; @import "node_modules/weaver-ui-core/app/resources/styles/sass/theme-base"; +@import "home/all"; @import "directives/all"; @import "management/all"; @@ -30,7 +31,7 @@ main footer { } .userMenu { - margin-bottom: 25px; + margin-bottom: 5px; } .toggle-href { diff --git a/app/resources/styles/sass/home/_all.scss b/app/resources/styles/sass/home/_all.scss new file mode 100644 index 0000000..509e176 --- /dev/null +++ b/app/resources/styles/sass/home/_all.scss @@ -0,0 +1 @@ +@import "kanban"; \ No newline at end of file diff --git a/app/resources/styles/sass/home/_kanban.scss b/app/resources/styles/sass/home/_kanban.scss new file mode 100644 index 0000000..4a62d3f --- /dev/null +++ b/app/resources/styles/sass/home/_kanban.scss @@ -0,0 +1,36 @@ +@media only screen and (min-width : 992px) { + .kanban { + display: inline-flex; + width: 100%; + } + + .kanban .column { + display: inline-block; + width: 100%; + margin: 4px; + } +} + +.kanban-panel { + .panel-body { + padding: 5px; + } + + .kanban-card { + margin-bottom: 5px; + } +} + +.popover-title { + color: #000; + background: #d9edf7; +} + +.popover-content { + color: #000; +} + +.avatar { + margin-right: 4px; +} + diff --git a/app/services/activeSprintsService.js b/app/services/activeSprintsService.js new file mode 100644 index 0000000..1747055 --- /dev/null +++ b/app/services/activeSprintsService.js @@ -0,0 +1,37 @@ +app.service('ActiveSprintsService', function ($q, WsApi) { + + var activeSprints = []; + + var defer = $q.defer(); + + var process = function (response) { + var apiRes = angular.fromJson(response.body); + if (apiRes.meta.status === 'SUCCESS') { + activeSprints.length = 0; + angular.extend(activeSprints, apiRes.payload['ArrayList']); + defer.notify(); + } else { + console.error(apiRes.meta); + throw "Unable to retrieve active sprints"; + } + }; + + WsApi.listen(apiMapping.ActiveSprints.listen).then(null, null, function (response) { + process(response); + }); + + this.refreshActiveSprints = function () { + WsApi.fetch(apiMapping.ActiveSprints.all).then(function (response) { + process(response); + }); + }; + + this.getActiveSprints = function () { + return activeSprints; + }; + + this.refreshActiveSprints(); + + this.updated = defer.promise; + +}); \ No newline at end of file diff --git a/app/services/projectsStatsService.js b/app/services/projectsStatsService.js new file mode 100644 index 0000000..93aa278 --- /dev/null +++ b/app/services/projectsStatsService.js @@ -0,0 +1,49 @@ +app.service('ProjectsStatsService', function ($q, ProjectRepo, WsApi) { + + var projectsStats = []; + + var defer = $q.defer(); + + var process = function (response) { + var apiRes = angular.fromJson(response.body); + if (apiRes.meta.status === 'SUCCESS') { + angular.extend(projectsStats, apiRes.payload['ArrayList']); + defer.resolve(); + ProjectRepo.reset(); + } else { + console.error(apiRes.meta); + throw "Unable to retrieve remote projects"; + } + }; + + WsApi.listen(apiMapping.ProjectsStats.listen).then(null, null, function (response) { + process(response); + }); + + this.refreshProjectsStats = function () { + WsApi.fetch(apiMapping.ProjectsStats.all).then(function (response) { + process(response); + }); + }; + + this.getProjectsStats = function () { + return projectsStats; + }; + + this.getById = function (id) { + return $q(function (resolve, reject) { + this.ready.then(function () { + for (var i in projectsStats) { + if (projectsStats[i].id == id) { + resolve(projectsStats[i]); + } + } + }); + }.bind(this)); + }; + + this.refreshProjectsStats(); + + this.ready = defer.promise; + +}); \ No newline at end of file diff --git a/app/services/remoteProjectsService.js b/app/services/remoteProjectsService.js new file mode 100644 index 0000000..11b259c --- /dev/null +++ b/app/services/remoteProjectsService.js @@ -0,0 +1,52 @@ +app.service('RemoteProjectsService', function ($q, ProjectRepo, WsApi) { + + var remoteProjects = {}; + + var defer = $q.defer(); + + var process = function (response) { + var apiRes = angular.fromJson(response.body); + if (apiRes.meta.status === 'SUCCESS') { + for (var key in remoteProjects) { + remoteProjects[key] = undefined; + } + angular.extend(remoteProjects, apiRes.payload.HashMap); + defer.resolve(); + ProjectRepo.reset(); + } else { + console.error(apiRes.meta); + throw "Unable to retrieve remote projects"; + } + }; + + WsApi.listen(apiMapping.RemoteProjects.listen).then(null, null, function (response) { + process(response); + }); + + this.refreshRemoteProjects = function () { + WsApi.fetch(apiMapping.RemoteProjects.all).then(function (response) { + process(response); + }); + }; + + this.getRemoteProjects = function () { + return remoteProjects; + }; + + this.getByScopeId = function (remoteProjectManagerId, scopeId) { + return $q(function (resolve, reject) { + this.ready.then(function () { + for (var i in remoteProjects[remoteProjectManagerId]) { + if (remoteProjects[remoteProjectManagerId][i].id === scopeId) { + resolve(remoteProjects[remoteProjectManagerId][i]); + } + } + }); + }.bind(this)); + }; + + this.refreshRemoteProjects(); + + this.ready = defer.promise; + +}); \ No newline at end of file diff --git a/app/services/versionProjectService.js b/app/services/versionProjectService.js deleted file mode 100644 index fb4cca2..0000000 --- a/app/services/versionProjectService.js +++ /dev/null @@ -1,35 +0,0 @@ -app.service('VersionProjectService', function ($q, WsApi) { - - this.getAll = function (vmsId) { - angular.extend(apiMapping.VersionProject.all, { - 'method': vmsId + "/version-projects" - }); - return $q(function (resolve, reject) { - WsApi.fetch(apiMapping.VersionProject.all).then(function (response) { - var apiRes = angular.fromJson(response.body); - if (apiRes.meta.status === 'SUCCESS') { - resolve(apiRes.payload['ArrayList']); - } else { - reject(); - } - }); - }); - }; - - this.getByScopeId = function (vmsId, scopeId) { - angular.extend(apiMapping.VersionProject.getByScopeId, { - 'method': vmsId + "/version-projects/" + scopeId - }); - return $q(function (resolve, reject) { - WsApi.fetch(apiMapping.VersionProject.getByScopeId).then(function (response) { - var apiRes = angular.fromJson(response.body); - if (apiRes.meta.status === 'SUCCESS') { - resolve(apiRes.payload.VersionProject); - } else { - reject(); - } - }); - }); - }; - -}); \ No newline at end of file diff --git a/app/views/directives/remoteProjectManagerForm.html b/app/views/directives/remoteProjectManagerForm.html new file mode 100644 index 0000000..edd17ad --- /dev/null +++ b/app/views/directives/remoteProjectManagerForm.html @@ -0,0 +1,13 @@ +
+ + +
+
+ +
+ +
+
\ No newline at end of file diff --git a/app/views/directives/vmsForm.html b/app/views/directives/vmsForm.html deleted file mode 100644 index 8383e93..0000000 --- a/app/views/directives/vmsForm.html +++ /dev/null @@ -1,9 +0,0 @@ -
- - -
diff --git a/app/views/errors/403.html b/app/views/errors/403.html old mode 100755 new mode 100644 diff --git a/app/views/errors/404.html b/app/views/errors/404.html old mode 100755 new mode 100644 diff --git a/app/views/errors/500.html b/app/views/errors/500.html old mode 100755 new mode 100644 diff --git a/app/views/home.html b/app/views/home.html old mode 100755 new mode 100644 index 1915ec1..7dc3bfa --- a/app/views/home.html +++ b/app/views/home.html @@ -1 +1,116 @@ -
+
+ +
+ + +
+
+
+ +
+
+
Active Sprints
+ + + + + + + + + + + + + + + + + + + +
IdNameProjectNumber of CardsTotal Points
{{sprint.id}}{{sprint.name}}{{sprint.project}}{{sprint.cards.length}}{{getSprintEstimateTotal(sprint)}}
+
+
+ +
+
+
{{kanbanHeader()}}
+ +
+
+
+
{{status.identifier}}
+
+ +
+
+ {{card.number}} + + + Cinque Terre + + + +
+ +
+

{{card.name}}

+
+ + +
+ +
+ + + +
+
+
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
ProjectTotal Backlog ItemsFeature CountDefect CountRequest CountIssue Count
{{project.name}}{{project.stats.backlogItemCount}}{{project.stats.featureCount}}{{project.stats.defectCount}}{{project.stats.requestCount}}{{project.stats.issueCount}}
+ +
+
+ +
+
+ +
\ No newline at end of file diff --git a/app/views/management.html b/app/views/management.html index 0a6c5df..37495df 100644 --- a/app/views/management.html +++ b/app/views/management.html @@ -1,15 +1,15 @@ -
+
-
+
Projects - Version Management Software + Statuses + Remote Progect Managers Users - - +
diff --git a/app/views/management/projects.html b/app/views/management/projects.html index 4cee392..a543305 100644 --- a/app/views/management/projects.html +++ b/app/views/management/projects.html @@ -3,11 +3,18 @@
- - +
+ + + + + + + + - - + +
ProjectRemote Project ManagerRemote ProjectScope IdActions
{{project.name}}{{project.versionManagementSoftware.name}}{{getVersionProject(project).name}}{{project.remoteProjectManager.name}}{{project.remoteProject.name}} {{project.scopeId}} diff --git a/app/views/management/remoteProjectManager.html b/app/views/management/remoteProjectManager.html new file mode 100644 index 0000000..a98978d --- /dev/null +++ b/app/views/management/remoteProjectManager.html @@ -0,0 +1,32 @@ +
+ + +
+ + + + + + + + + + + + +
Remote Project ManagerSettingsActions
{{remoteProjectManager.name}} +
    +
  • + +  {{remoteProjectManager.settings[setting.key]}} +
  • +
+
+ + +
+ + + + +
\ No newline at end of file diff --git a/app/views/management/statuses.html b/app/views/management/statuses.html new file mode 100644 index 0000000..4133a08 --- /dev/null +++ b/app/views/management/statuses.html @@ -0,0 +1,25 @@ +
+ + +
+ + + + + + + + + + + + +
StatusMappingActions
{{status.identifier}}{{status.mapping.join(', ')}} + + +
+ + + + +
\ No newline at end of file diff --git a/app/views/management/users.html b/app/views/management/users.html index 7660816..be64748 100644 --- a/app/views/management/users.html +++ b/app/views/management/users.html @@ -2,10 +2,10 @@
-
+
-
+

Users

@@ -41,6 +41,4 @@

Users

-
- - \ No newline at end of file +
\ No newline at end of file diff --git a/app/views/management/versionManagementSoftware.html b/app/views/management/versionManagementSoftware.html deleted file mode 100644 index dbe5206..0000000 --- a/app/views/management/versionManagementSoftware.html +++ /dev/null @@ -1,27 +0,0 @@ -
- - -
- - - - - - - -
{{vms.name}} -
    -
  • - -  {{vms.settings[setting.key]}} -
  • -
-
- - -
- - - - -
\ No newline at end of file diff --git a/app/views/modals/addProjectModal.html b/app/views/modals/addProjectModal.html index 557a593..931a612 100644 --- a/app/views/modals/addProjectModal.html +++ b/app/views/modals/addProjectModal.html @@ -1,5 +1,7 @@ @@ -8,33 +10,27 @@ \ No newline at end of file diff --git a/app/views/modals/addRemoteProjectManagerModal.html b/app/views/modals/addRemoteProjectManagerModal.html new file mode 100644 index 0000000..ff8e9cc --- /dev/null +++ b/app/views/modals/addRemoteProjectManagerModal.html @@ -0,0 +1,24 @@ + + +
+ + + + + + +
\ No newline at end of file diff --git a/app/views/modals/addStatusModal.html b/app/views/modals/addStatusModal.html new file mode 100644 index 0000000..5fd0e07 --- /dev/null +++ b/app/views/modals/addStatusModal.html @@ -0,0 +1,41 @@ + + +
+ + + + + + + +
\ No newline at end of file diff --git a/app/views/modals/addVmsModal.html b/app/views/modals/addVmsModal.html deleted file mode 100644 index cd2276d..0000000 --- a/app/views/modals/addVmsModal.html +++ /dev/null @@ -1,43 +0,0 @@ - - -
- - - - - -
\ No newline at end of file diff --git a/app/views/modals/deleteRemoteProjectManagerModal.html b/app/views/modals/deleteRemoteProjectManagerModal.html new file mode 100644 index 0000000..12e8fc8 --- /dev/null +++ b/app/views/modals/deleteRemoteProjectManagerModal.html @@ -0,0 +1,16 @@ +
+ + + +
\ No newline at end of file diff --git a/app/views/modals/deleteVmsModal.html b/app/views/modals/deleteStatusModal.html similarity index 60% rename from app/views/modals/deleteVmsModal.html rename to app/views/modals/deleteStatusModal.html index 92e6d34..d3f68ea 100644 --- a/app/views/modals/deleteVmsModal.html +++ b/app/views/modals/deleteStatusModal.html @@ -1,14 +1,16 @@ -
+ +

{{statusToDelete.identifier}}

+
\ No newline at end of file diff --git a/app/views/modals/editProjectModal.html b/app/views/modals/editProjectModal.html index 19502b1..3c28168 100644 --- a/app/views/modals/editProjectModal.html +++ b/app/views/modals/editProjectModal.html @@ -1,5 +1,7 @@ @@ -7,37 +9,30 @@ - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/modals/editRemoteProjectManagerModal.html b/app/views/modals/editRemoteProjectManagerModal.html new file mode 100644 index 0000000..cb4102a --- /dev/null +++ b/app/views/modals/editRemoteProjectManagerModal.html @@ -0,0 +1,24 @@ + + +
+ + + + + + +
\ No newline at end of file diff --git a/app/views/modals/editStatusModal.html b/app/views/modals/editStatusModal.html new file mode 100644 index 0000000..f47785e --- /dev/null +++ b/app/views/modals/editStatusModal.html @@ -0,0 +1,43 @@ + + +
+ + + + + + + +
\ No newline at end of file diff --git a/app/views/modals/editVmsModal.html b/app/views/modals/editVmsModal.html deleted file mode 100644 index 5e18ae0..0000000 --- a/app/views/modals/editVmsModal.html +++ /dev/null @@ -1,44 +0,0 @@ - - -
- - - - - - -
\ No newline at end of file diff --git a/app/views/theme.html b/app/views/theme.html old mode 100755 new mode 100644 diff --git a/karma.conf.js b/karma.conf.js old mode 100755 new mode 100644 diff --git a/package-lock.json b/package-lock.json index 3e158e4..564d1c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3965,12 +3965,6 @@ "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, - "jasmine-promise-matchers": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/jasmine-promise-matchers/-/jasmine-promise-matchers-2.5.0.tgz", - "integrity": "sha1-TBvf85qk8bBKtxzawluSt7LhpjA=", - "dev": true - }, "jasminewd2": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/jasminewd2/-/jasminewd2-2.2.0.tgz", @@ -6253,7 +6247,7 @@ "dev": true }, "weaver-ui-core": { - "version": "git+https://github.com/TAMULib/Weaver-UI-Core.git#329868fbfa1a8d4edcd5ca67994aa6269c3dfaa6", + "version": "git+https://github.com/TAMULib/Weaver-UI-Core.git#7f24204645998e80f10d8efc6f53cda947a92884", "requires": { "angular": "1.6.5", "angular-loader": "1.6.5", diff --git a/package.json b/package.json old mode 100755 new mode 100644 index 9a0e27d..598a7fa --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "project-management", - "private": true, + "private": false, "version": "1.0.0", "description": "A UI for managing projects", "repository": "https://github.com/TAMULib/ProjectManagementUI.git", @@ -36,7 +36,6 @@ "grunt-karma-coveralls": "2.5.4", "grunt-sass": "2.0.0", "grunt-usemin": "3.1.1", - "jasmine-promise-matchers": "2.5.0", "jshint-stylish": "2.2.1", "karma": "1.7.1", "karma-chrome-launcher": "2.2.0", @@ -47,4 +46,4 @@ "karma-ng-html2js-preprocessor": "1.0.0", "protractor": "5.1.2" } -} \ No newline at end of file +} diff --git a/tests/e2e/auth-spec.js b/tests/e2e/auth-spec.js old mode 100755 new mode 100644 diff --git a/tests/e2e/index-spec.js b/tests/e2e/index-spec.js old mode 100755 new mode 100644 diff --git a/tests/e2e/protractor.conf.js b/tests/e2e/protractor.conf.js old mode 100755 new mode 100644 diff --git a/tests/e2e/users-spec.js b/tests/e2e/users-spec.js old mode 100755 new mode 100644 diff --git a/tests/mocks/models/mockAssumedControl.js b/tests/mocks/models/mockAssumedControl.js old mode 100755 new mode 100644 index 66d8d09..b5761e5 --- a/tests/mocks/models/mockAssumedControl.js +++ b/tests/mocks/models/mockAssumedControl.js @@ -29,7 +29,6 @@ var mockAssumedControl3 = { 'status': '' }; -angular.module('mock.AssumedControl', []). -service('AssumedControl', function ($q) { +angular.module('mock.AssumedControl', []).service('AssumedControl', function ($q) { return this; }); \ No newline at end of file diff --git a/tests/mocks/models/mockRemoteProjectManager.js b/tests/mocks/models/mockRemoteProjectManager.js new file mode 100644 index 0000000..0c72213 --- /dev/null +++ b/tests/mocks/models/mockRemoteProjectManager.js @@ -0,0 +1,8 @@ +angular.module('mock.remoteProjectManager', []).service('RemoteProjectManager', function () { + + this.save = function () {}; + this.dirty = function (bool) {}; + this.refresh = function () {}; + + return this; +}); \ No newline at end of file diff --git a/tests/mocks/models/mockStatus.js b/tests/mocks/models/mockStatus.js new file mode 100644 index 0000000..7b18ce1 --- /dev/null +++ b/tests/mocks/models/mockStatus.js @@ -0,0 +1,10 @@ +angular.module('mock.status', []).service('Status', function () { + + this.mapping = []; + + this.save = function () {}; + this.dirty = function (bool) {}; + this.refresh = function () {}; + + return this; +}); \ No newline at end of file diff --git a/tests/mocks/models/mockUser.js b/tests/mocks/models/mockUser.js old mode 100755 new mode 100644 index 5a5a012..7047ec8 --- a/tests/mocks/models/mockUser.js +++ b/tests/mocks/models/mockUser.js @@ -28,7 +28,6 @@ var mockUser3 = { "netId": "jsmith" }; -angular.module('mock.user', []). -service('User', function ($q) { +angular.module('mock.user', []).service('User', function ($q) { return this; }); \ No newline at end of file diff --git a/tests/mocks/models/mockVersionManagementSoftware.js b/tests/mocks/models/mockVersionManagementSoftware.js deleted file mode 100644 index 0c41c38..0000000 --- a/tests/mocks/models/mockVersionManagementSoftware.js +++ /dev/null @@ -1,9 +0,0 @@ -angular.module('mock.versionManagementSoftware', []).service('VersionManagementSoftware', function() { - var VersionManagementSoftware = this; - - this.save = function() {}; - this.dirty = function(bool) {}; - this.refresh = function() {}; - - return VersionManagementSoftware; -}); \ No newline at end of file diff --git a/tests/mocks/repo/mockProjectRepo.js b/tests/mocks/repo/mockProjectRepo.js index 4ba0243..8de924d 100644 --- a/tests/mocks/repo/mockProjectRepo.js +++ b/tests/mocks/repo/mockProjectRepo.js @@ -53,6 +53,10 @@ angular.module('mock.projectRepo', []).service('ProjectRepo', function ($q) { } }; + this.reset = function () { + + }; + this.ready = function () { var defer = $q.defer(); defer.resolve(); diff --git a/tests/mocks/repo/mockRemoteProjectManagerRepo.js b/tests/mocks/repo/mockRemoteProjectManagerRepo.js new file mode 100644 index 0000000..739ef54 --- /dev/null +++ b/tests/mocks/repo/mockRemoteProjectManagerRepo.js @@ -0,0 +1,90 @@ +var mockRemoteProjectManageres = [{ + "id": 1, + "name": "Test 1", + "type": "VERSION_ONE", + "settings": { + "password": "password1", + "url": "url1", + "username": "username1" + } +}, +{ + "id": 2, + "name": "Test 2", + "type": "VERSION_ONE", + "settings": { + "password": "password2", + "url": "url2", + "username": "username2" + } +}, +{ + "id": 3, + "name": "Test 3", + "type": "VERSION_ONE", + "settings": { + "password": "password3", + "url": "url3", + "username": "username3" + } +} +]; + +angular.module('mock.remoteProjectManagerRepo', []).service('RemoteProjectManagerRepo', function ($q) { + +this.scaffold = {}; + +this.list = mockRemoteProjectManageres; + +this.getAll = function () { + var defer = $q.defer(); + defer.resolve(this.list); + return defer.promise; +}; + +this.findById = function (id) { + for (var i in this.list) { + if (this.list[i].id === id) { + return this.list[i]; + } + } +}; + +this.getScaffold = function (defaults) { + if (!defaults) defaults = {}; + return angular.copy(angular.extend(this.scaffold, defaults)); +}; + +this.getTypes = function () { + var defer = $q.defer(); + defer.resolve(); + return defer.promise; +}; + +this.create = function (remoteProjectManager) { + var defer = $q.defer(); + remoteProjectManager.id = this.list.length + 1; + this.list.push(remoteProjectManager); + defer.resolve(remoteProjectManager); + return defer.promise; +}; + +this.getValidations = function () {}; + +this.clearValidationResults = function () {}; + +this.ready = function () { + var defer = $q.defer(); + defer.resolve(); + return defer.promise; +}; + +this.getTypeScaffolding = function (type) {}; + +this.listen = function () {}; + +this.delete = function () {}; + +return this; + +}); \ No newline at end of file diff --git a/tests/mocks/repo/mockStatusRepo.js b/tests/mocks/repo/mockStatusRepo.js new file mode 100644 index 0000000..899b152 --- /dev/null +++ b/tests/mocks/repo/mockStatusRepo.js @@ -0,0 +1,105 @@ +var mockStatuses = [{ + "id": 1, + "identifier": "None", + "mapping": [ + "None", + "Future" + ] + }, + { + "id": 2, + "identifier": "In Progress", + "mapping": [ + "In Progress" + ] + }, + { + "id": 3, + "identifier": "Done", + "mapping": [ + "Done" + ] + }, + { + "id": 4, + "identifier": "Accepted", + "mapping": [ + "Accepted" + ] + } +]; + +angular.module('mock.statusRepo', []).service('StatusRepo', function ($q) { + + this.list = mockStatuses; + + this.create = function (project) { + var defer = $q.defer(); + project.id = this.list.length + 1; + this.list.push(project); + defer.resolve(project); + return defer.promise; + }; + + this.update = function (project) { + var defer = $q.defer(); + for (var i in this.list) { + if (this.list[i].id === project.id) { + angular.extend(this.list[i], project); + project = this.list[i]; + break; + } + } + defer.resolve(project); + return defer.promise; + }; + + this.delete = function (project) {}; + + this.getAll = function () { + var defer = $q.defer(); + defer.resolve(this.list); + return defer.promise; + }; + + this.findById = function (id) { + for (var i in this.list) { + if (this.list[i].id === id) { + return this.list[i]; + } + } + }; + + this.ready = function () { + var defer = $q.defer(); + defer.resolve(); + return defer.promise; + }; + + this.scaffold = { + + }; + + this.getScaffold = function (defaults) { + if (!defaults) defaults = {}; + return angular.copy(angular.extend(this.scaffold, defaults)); + }; + + var validations = { + + }; + + this.getValidations = function () { + return validations; + }; + + this.clearValidationResults = function () { + + }; + + this.listen = function () { + + }; + + return this; +}); \ No newline at end of file diff --git a/tests/mocks/repo/mockUserRepo.js b/tests/mocks/repo/mockUserRepo.js old mode 100755 new mode 100644 diff --git a/tests/mocks/repo/mockVersionManagementSoftwareRepo.js b/tests/mocks/repo/mockVersionManagementSoftwareRepo.js deleted file mode 100644 index c06b553..0000000 --- a/tests/mocks/repo/mockVersionManagementSoftwareRepo.js +++ /dev/null @@ -1,90 +0,0 @@ -var mockVmses = [{ - "id": 1, - "name": "Test 1", - "type": "VERSION_ONE", - "settings": { - "password": "password1", - "url": "url1", - "username": "username1" - } - }, - { - "id": 2, - "name": "Test 2", - "type": "VERSION_ONE", - "settings": { - "password": "password2", - "url": "url2", - "username": "username2" - } - }, - { - "id": 3, - "name": "Test 3", - "type": "VERSION_ONE", - "settings": { - "password": "password3", - "url": "url3", - "username": "username3" - } - } -]; - -angular.module('mock.versionManagementSoftwareRepo', []).service('VersionManagementSoftwareRepo', function ($q) { - - this.scaffold = {}; - - this.list = mockVmses; - - this.getAll = function () { - var defer = $q.defer(); - defer.resolve(this.list); - return defer.promise; - }; - - this.findById = function (id) { - for (var i in this.list) { - if (this.list[i].id === id) { - return this.list[i]; - } - } - }; - - this.getScaffold = function (defaults) { - if (!defaults) defaults = {}; - return angular.copy(angular.extend(this.scaffold, defaults)); - }; - - this.getTypes = function () { - var defer = $q.defer(); - defer.resolve(); - return defer.promise; - }; - - this.create = function (vms) { - var defer = $q.defer(); - vms.id = this.list.length + 1; - this.list.push(vms); - defer.resolve(vms); - return defer.promise; - }; - - this.getValidations = function () {}; - - this.clearValidationResults = function () {}; - - this.ready = function () { - var defer = $q.defer(); - defer.resolve(); - return defer.promise; - }; - - this.getTypeScaffolding = function (type) {}; - - this.listen = function () {}; - - this.delete = function () {}; - - return this; - -}); \ No newline at end of file diff --git a/tests/mocks/services/mockActiveSprintsService.js b/tests/mocks/services/mockActiveSprintsService.js new file mode 100644 index 0000000..05ac111 --- /dev/null +++ b/tests/mocks/services/mockActiveSprintsService.js @@ -0,0 +1,93 @@ +var mockActiveSprints = [{ + "id": "7820", + "name": "Sprint 3", + "project": "chronam", + "cards": [{ + "id": "7802", + "number": "B-03351", + "type": "Feature", + "status": "Accepted", + "name": "As a Customer I want to see 8 random issues on the front page, so that blank entries don't ever show", + "estimate": 2, + "assignees": [] + }, { + "id": "7803", + "number": "D-01153", + "type": "Defect", + "status": "Accepted", + "name": "Date limiting functionallity in search not working.", + "estimate": 3, + "assignees": [] + }, { + "id": "7804", + "number": "B-03352", + "type": "Feature", + "status": "Accepted", + "name": "Remove route for for viewing MARC records.", + "estimate": 0, + "assignees": [] + }, { + "id": "7805", + "number": "B-03353", + "type": "Feature", + "status": "Done", + "name": "Add pagination to bottom of search results.", + "estimate": 0.5, + "assignees": [] + }, { + "id": "7806", + "number": "B-03354", + "type": "Feature", + "status": "Accepted", + "name": "Add metadata to search results", + "estimate": 3, + "assignees": [] + }, { + "id": "7854", + "number": "B-03367", + "type": "Feature", + "status": "Done", + "name": "Rearrange and remove uneeded fields from advanced search page.", + "assignees": [] + }, { + "id": "7856", + "number": "B-03369", + "type": "Feature", + "status": "Accepted", + "name": "Search bar should redirect to search results when submitted.", + "assignees": [] + }, { + "id": "7859", + "number": "D-01155", + "type": "Defect", + "status": "Accepted", + "name": "Batch loading is failing on call to library of congress' website.", + "description": "

Attempting to retrieve an xml file from the LC website, but being denied permission.

\n

Moved a copy of the file to:

\n

http://php.library.tamu.edu/marc.xml

\n

And now hitting that url for the file.

", + "assignees": [{ + "id": "6616", + "name": "Ryan Laddusaw", + "avatar": "no_avatar.png" + }] + }, { + "id": "7860", + "number": "B-03370", + "type": "Feature", + "status": "Accepted", + "name": "Add advanced search link.", + "assignees": [{ + "id": "6616", + "name": "Ryan Laddusaw", + "avatar": "no_avatar.png" + }] + }] +}]; + +angular.module('mock.activeSprintsService', []).service('ActiveSprintsService', function ($q) { + + this.getActiveSprints = function () { + return mockActiveSprints; + }; + + this.updated = $q.defer().promise; + +}); \ No newline at end of file diff --git a/tests/mocks/services/mockProjectsStatsService.js b/tests/mocks/services/mockProjectsStatsService.js new file mode 100644 index 0000000..7775062 --- /dev/null +++ b/tests/mocks/services/mockProjectsStatsService.js @@ -0,0 +1,478 @@ +var mockProjectsStats = [{ + "id": "1", + "name": "Legacy DSpace", + "requestCount": 22, + "issueCount": 41, + "featureCount": 32, + "defectCount": 0, + "backlogItemCount": 32 +}, { + "id": "2", + "name": "Code Management - Maps", + "requestCount": 0, + "issueCount": 0, + "featureCount": 5, + "defectCount": 0, + "backlogItemCount": 5 +}, { + "id": "3", + "name": "CORAL - Electronic Resource Management", + "requestCount": 2, + "issueCount": 0, + "featureCount": 12, + "defectCount": 8, + "backlogItemCount": 20 +}, { + "id": "4", + "name": "Piper - Automated Ingest", + "requestCount": 8, + "issueCount": 0, + "featureCount": 42, + "defectCount": 0, + "backlogItemCount": 42 +}, { + "id": "5", + "name": "Vireo", + "requestCount": 0, + "issueCount": 0, + "featureCount": 6, + "defectCount": 0, + "backlogItemCount": 6 +}, { + "id": "6", + "name": "Pelican", + "requestCount": 0, + "issueCount": 0, + "featureCount": 43, + "defectCount": 0, + "backlogItemCount": 43 +}, { + "id": "7", + "name": "VIVO", + "requestCount": 0, + "issueCount": 0, + "featureCount": 4, + "defectCount": 0, + "backlogItemCount": 4 +}, { + "id": "8", + "name": "Health Based MSL", + "requestCount": 0, + "issueCount": 0, + "featureCount": 10, + "defectCount": 0, + "backlogItemCount": 10 +}, { + "id": "9", + "name": "ORCID", + "requestCount": 0, + "issueCount": 0, + "featureCount": 3, + "defectCount": 0, + "backlogItemCount": 3 +}, { + "id": "10", + "name": "MIS Reports", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "11", + "name": "Collaborative Book Reader", + "requestCount": 0, + "issueCount": 0, + "featureCount": 38, + "defectCount": 0, + "backlogItemCount": 38 +}, { + "id": "12", + "name": "DI Internal", + "requestCount": 1, + "issueCount": 0, + "featureCount": 10, + "defectCount": 0, + "backlogItemCount": 10 +}, { + "id": "13", + "name": "LibCat", + "requestCount": 0, + "issueCount": 0, + "featureCount": 9, + "defectCount": 0, + "backlogItemCount": 9 +}, { + "id": "14", + "name": "Vireo - Undergraduate", + "requestCount": 0, + "issueCount": 1, + "featureCount": 5, + "defectCount": 0, + "backlogItemCount": 5 +}, { + "id": "15", + "name": "Key Database", + "requestCount": 0, + "issueCount": 0, + "featureCount": 13, + "defectCount": 0, + "backlogItemCount": 13 +}, { + "id": "16", + "name": "MyLibrary Application", + "requestCount": 3, + "issueCount": 4, + "featureCount": 25, + "defectCount": 6, + "backlogItemCount": 31 +}, { + "id": "17", + "name": "DSpace", + "requestCount": 5, + "issueCount": 1, + "featureCount": 16, + "defectCount": 3, + "backlogItemCount": 19 +}, { + "id": "18", + "name": "iRODS", + "requestCount": 0, + "issueCount": 0, + "featureCount": 18, + "defectCount": 0, + "backlogItemCount": 18 +}, { + "id": "19", + "name": "Hours Application", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "20", + "name": "MAGPIE", + "requestCount": 9, + "issueCount": 9, + "featureCount": 24, + "defectCount": 1, + "backlogItemCount": 25 +}, { + "id": "21", + "name": "Directory App Rewrite", + "requestCount": 6, + "issueCount": 11, + "featureCount": 6, + "defectCount": 2, + "backlogItemCount": 8 +}, { + "id": "22", + "name": "Digital Asset Management Ecosystem", + "requestCount": 0, + "issueCount": 2, + "featureCount": 8, + "defectCount": 0, + "backlogItemCount": 8 +}, { + "id": "23", + "name": "Applications", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "24", + "name": "Legacy Projects", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "25", + "name": "Subject Librarians", + "requestCount": 7, + "issueCount": 2, + "featureCount": 4, + "defectCount": 1, + "backlogItemCount": 5 +}, { + "id": "26", + "name": "Dev Ops", + "requestCount": 0, + "issueCount": 0, + "featureCount": 2, + "defectCount": 1, + "backlogItemCount": 3 +}, { + "id": "27", + "name": "DSpace UI Prototype", + "requestCount": 0, + "issueCount": 0, + "featureCount": 8, + "defectCount": 0, + "backlogItemCount": 8 +}, { + "id": "28", + "name": "Library Cascade", + "requestCount": 0, + "issueCount": 0, + "featureCount": 8, + "defectCount": 0, + "backlogItemCount": 8 +}, { + "id": "29", + "name": "Instructional Request Manager - Old", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "30", + "name": "Weaver (Spring/Angular Frameworks)", + "requestCount": 0, + "issueCount": 1, + "featureCount": 24, + "defectCount": 0, + "backlogItemCount": 24 +}, { + "id": "31", + "name": "Sugar CRM UI rewrite", + "requestCount": 0, + "issueCount": 2, + "featureCount": 2, + "defectCount": 0, + "backlogItemCount": 2 +}, { + "id": "32", + "name": "Catalog Services", + "requestCount": 1, + "issueCount": 0, + "featureCount": 9, + "defectCount": 0, + "backlogItemCount": 9 +}, { + "id": "33", + "name": "Digital Aggieland Portal", + "requestCount": 0, + "issueCount": 0, + "featureCount": 10, + "defectCount": 0, + "backlogItemCount": 10 +}, { + "id": "34", + "name": "Instructional Apps", + "requestCount": 0, + "issueCount": 0, + "featureCount": 18, + "defectCount": 5, + "backlogItemCount": 23 +}, { + "id": "35", + "name": "Instructional Statistics Manager - Old", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "36", + "name": "Instructional Database", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "37", + "name": "Automatic Metadata Assignment", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "38", + "name": "Semi-Automatic NALT Indexer", + "requestCount": 8, + "issueCount": 0, + "featureCount": 5, + "defectCount": 1, + "backlogItemCount": 6 +}, { + "id": "39", + "name": "Development", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "40", + "name": "Development Services", + "requestCount": 0, + "issueCount": 0, + "featureCount": 3, + "defectCount": 0, + "backlogItemCount": 3 +}, { + "id": "41", + "name": "Application Services", + "requestCount": 0, + "issueCount": 0, + "featureCount": 3, + "defectCount": 0, + "backlogItemCount": 3 +}, { + "id": "42", + "name": "VersionOne Service", + "requestCount": 0, + "issueCount": 0, + "featureCount": 1, + "defectCount": 0, + "backlogItemCount": 1 +}, { + "id": "43", + "name": "Sugar", + "requestCount": 0, + "issueCount": 0, + "featureCount": 1, + "defectCount": 2, + "backlogItemCount": 3 +}, { + "id": "44", + "name": "PHP MicroServices", + "requestCount": 0, + "issueCount": 0, + "featureCount": 4, + "defectCount": 0, + "backlogItemCount": 4 +}, { + "id": "45", + "name": "SharePoint", + "requestCount": 0, + "issueCount": 0, + "featureCount": 1, + "defectCount": 0, + "backlogItemCount": 1 +}, { + "id": "46", + "name": "SFFRD", + "requestCount": 0, + "issueCount": 0, + "featureCount": 5, + "defectCount": 5, + "backlogItemCount": 10 +}, { + "id": "47", + "name": "Instructional Request Manager", + "requestCount": 5, + "issueCount": 2, + "featureCount": 5, + "defectCount": 1, + "backlogItemCount": 6 +}, { + "id": "48", + "name": "Instructional Statistics Manager", + "requestCount": 2, + "issueCount": 0, + "featureCount": 4, + "defectCount": 1, + "backlogItemCount": 5 +}, { + "id": "49", + "name": "Organization Chart", + "requestCount": 0, + "issueCount": 0, + "featureCount": 18, + "defectCount": 1, + "backlogItemCount": 19 +}, { + "id": "50", + "name": "Library Service Status System", + "requestCount": 1, + "issueCount": 0, + "featureCount": 34, + "defectCount": 4, + "backlogItemCount": 38 +}, { + "id": "51", + "name": "Fedora", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "52", + "name": "Spotlight", + "requestCount": 2, + "issueCount": 0, + "featureCount": 19, + "defectCount": 2, + "backlogItemCount": 21 +}, { + "id": "53", + "name": "IIIF Generation Service", + "requestCount": 1, + "issueCount": 0, + "featureCount": 2, + "defectCount": 1, + "backlogItemCount": 3 +}, { + "id": "54", + "name": "chronam", + "requestCount": 1, + "issueCount": 0, + "featureCount": 10, + "defectCount": 2, + "backlogItemCount": 12 +}, { + "id": "55", + "name": "Cap", + "requestCount": 0, + "issueCount": 0, + "featureCount": 11, + "defectCount": 0, + "backlogItemCount": 11 +}, { + "id": "56", + "name": "SAGE", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 +}, { + "id": "57", + "name": "Project Management Service", + "requestCount": 0, + "issueCount": 0, + "featureCount": 17, + "defectCount": 1, + "backlogItemCount": 18 +}]; + +angular.module('mock.projectsStatsService', []).service('ProjectsStatsService', function ($q) { + + this.getProjectsStats = function () { + return mockProjectsStats; + }; + + this.getById = function (id) { + return $q(function (resolve, reject) { + for (var i in projectsStats) { + if (projectsStats[i].id == id) { + resolve(projectsStats[i]); + } + } + reject(undefined); + }); + }; + + this.ready = $q.defer().promise; + +}); \ No newline at end of file diff --git a/tests/mocks/services/mockRemoteProjectService.js b/tests/mocks/services/mockRemoteProjectService.js new file mode 100644 index 0000000..58fe20d --- /dev/null +++ b/tests/mocks/services/mockRemoteProjectService.js @@ -0,0 +1,480 @@ +var mockRemoteProjects = { + "1": [{ + "id": "1934", + "name": "Legacy DSpace", + "requestCount": 22, + "issueCount": 41, + "featureCount": 32, + "defectCount": 0, + "backlogItemCount": 32 + }, { + "id": "3781", + "name": "Code Management - Maps", + "requestCount": 0, + "issueCount": 0, + "featureCount": 5, + "defectCount": 0, + "backlogItemCount": 5 + }, { + "id": "3783", + "name": "CORAL - Electronic Resource Management", + "requestCount": 2, + "issueCount": 0, + "featureCount": 12, + "defectCount": 8, + "backlogItemCount": 20 + }, { + "id": "3786", + "name": "Piper - Automated Ingest", + "requestCount": 8, + "issueCount": 0, + "featureCount": 42, + "defectCount": 0, + "backlogItemCount": 42 + }, { + "id": "3789", + "name": "Vireo", + "requestCount": 0, + "issueCount": 0, + "featureCount": 6, + "defectCount": 0, + "backlogItemCount": 6 + }, { + "id": "3798", + "name": "Pelican", + "requestCount": 0, + "issueCount": 0, + "featureCount": 43, + "defectCount": 0, + "backlogItemCount": 43 + }, { + "id": "3816", + "name": "VIVO", + "requestCount": 0, + "issueCount": 0, + "featureCount": 4, + "defectCount": 0, + "backlogItemCount": 4 + }, { + "id": "3930", + "name": "Health Based MSL", + "requestCount": 0, + "issueCount": 0, + "featureCount": 10, + "defectCount": 0, + "backlogItemCount": 10 + }, { + "id": "3968", + "name": "ORCID", + "requestCount": 0, + "issueCount": 0, + "featureCount": 3, + "defectCount": 0, + "backlogItemCount": 3 + }, { + "id": "4114", + "name": "MIS Reports", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "4182", + "name": "Collaborative Book Reader", + "requestCount": 0, + "issueCount": 0, + "featureCount": 38, + "defectCount": 0, + "backlogItemCount": 38 + }, { + "id": "4262", + "name": "DI Internal", + "requestCount": 1, + "issueCount": 0, + "featureCount": 10, + "defectCount": 0, + "backlogItemCount": 10 + }, { + "id": "4391", + "name": "LibCat", + "requestCount": 0, + "issueCount": 0, + "featureCount": 9, + "defectCount": 0, + "backlogItemCount": 9 + }, { + "id": "4557", + "name": "Vireo - Undergraduate", + "requestCount": 0, + "issueCount": 1, + "featureCount": 5, + "defectCount": 0, + "backlogItemCount": 5 + }, { + "id": "4731", + "name": "Key Database", + "requestCount": 0, + "issueCount": 0, + "featureCount": 13, + "defectCount": 0, + "backlogItemCount": 13 + }, { + "id": "4871", + "name": "MyLibrary Application", + "requestCount": 3, + "issueCount": 4, + "featureCount": 25, + "defectCount": 6, + "backlogItemCount": 31 + }, { + "id": "4889", + "name": "DSpace", + "requestCount": 5, + "issueCount": 1, + "featureCount": 16, + "defectCount": 3, + "backlogItemCount": 19 + }, { + "id": "4912", + "name": "iRODS", + "requestCount": 0, + "issueCount": 0, + "featureCount": 18, + "defectCount": 0, + "backlogItemCount": 18 + }, { + "id": "4965", + "name": "Hours Application", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "5070", + "name": "MAGPIE", + "requestCount": 9, + "issueCount": 9, + "featureCount": 24, + "defectCount": 1, + "backlogItemCount": 25 + }, { + "id": "5270", + "name": "Directory App Rewrite", + "requestCount": 6, + "issueCount": 11, + "featureCount": 6, + "defectCount": 2, + "backlogItemCount": 8 + }, { + "id": "5342", + "name": "Digital Asset Management Ecosystem", + "requestCount": 0, + "issueCount": 2, + "featureCount": 8, + "defectCount": 0, + "backlogItemCount": 8 + }, { + "id": "5523", + "name": "Applications", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "5524", + "name": "Legacy Projects", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "5525", + "name": "Subject Librarians", + "requestCount": 7, + "issueCount": 2, + "featureCount": 4, + "defectCount": 1, + "backlogItemCount": 5 + }, { + "id": "5798", + "name": "Dev Ops", + "requestCount": 0, + "issueCount": 0, + "featureCount": 2, + "defectCount": 1, + "backlogItemCount": 3 + }, { + "id": "5870", + "name": "DSpace UI Prototype", + "requestCount": 0, + "issueCount": 0, + "featureCount": 8, + "defectCount": 0, + "backlogItemCount": 8 + }, { + "id": "5910", + "name": "Library Cascade", + "requestCount": 0, + "issueCount": 0, + "featureCount": 8, + "defectCount": 0, + "backlogItemCount": 8 + }, { + "id": "5962", + "name": "Instructional Request Manager - Old", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "6004", + "name": "Weaver (Spring/Angular Frameworks)", + "requestCount": 0, + "issueCount": 1, + "featureCount": 24, + "defectCount": 0, + "backlogItemCount": 24 + }, { + "id": "6029", + "name": "Sugar CRM UI rewrite", + "requestCount": 0, + "issueCount": 2, + "featureCount": 2, + "defectCount": 0, + "backlogItemCount": 2 + }, { + "id": "6126", + "name": "Catalog Services", + "requestCount": 1, + "issueCount": 0, + "featureCount": 9, + "defectCount": 0, + "backlogItemCount": 9 + }, { + "id": "6157", + "name": "Digital Aggieland Portal", + "requestCount": 0, + "issueCount": 0, + "featureCount": 10, + "defectCount": 0, + "backlogItemCount": 10 + }, { + "id": "6368", + "name": "Instructional Apps", + "requestCount": 0, + "issueCount": 0, + "featureCount": 18, + "defectCount": 5, + "backlogItemCount": 23 + }, { + "id": "6369", + "name": "Instructional Statistics Manager - Old", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "6373", + "name": "Instructional Database", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "6486", + "name": "Automatic Metadata Assignment", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "6487", + "name": "Semi-Automatic NALT Indexer", + "requestCount": 8, + "issueCount": 0, + "featureCount": 5, + "defectCount": 1, + "backlogItemCount": 6 + }, { + "id": "6620", + "name": "Development", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "6625", + "name": "Development Services", + "requestCount": 0, + "issueCount": 0, + "featureCount": 3, + "defectCount": 0, + "backlogItemCount": 3 + }, { + "id": "6626", + "name": "Application Services", + "requestCount": 0, + "issueCount": 0, + "featureCount": 3, + "defectCount": 0, + "backlogItemCount": 3 + }, { + "id": "6627", + "name": "VersionOne Service", + "requestCount": 0, + "issueCount": 0, + "featureCount": 1, + "defectCount": 0, + "backlogItemCount": 1 + }, { + "id": "6629", + "name": "Sugar", + "requestCount": 0, + "issueCount": 0, + "featureCount": 1, + "defectCount": 2, + "backlogItemCount": 3 + }, { + "id": "6664", + "name": "PHP MicroServices", + "requestCount": 0, + "issueCount": 0, + "featureCount": 4, + "defectCount": 0, + "backlogItemCount": 4 + }, { + "id": "6828", + "name": "SharePoint", + "requestCount": 0, + "issueCount": 0, + "featureCount": 1, + "defectCount": 0, + "backlogItemCount": 1 + }, { + "id": "7001", + "name": "SFFRD", + "requestCount": 0, + "issueCount": 0, + "featureCount": 5, + "defectCount": 5, + "backlogItemCount": 10 + }, { + "id": "7036", + "name": "Instructional Request Manager", + "requestCount": 5, + "issueCount": 2, + "featureCount": 5, + "defectCount": 1, + "backlogItemCount": 6 + }, { + "id": "7037", + "name": "Instructional Statistics Manager", + "requestCount": 2, + "issueCount": 0, + "featureCount": 4, + "defectCount": 1, + "backlogItemCount": 5 + }, { + "id": "7400", + "name": "Organization Chart", + "requestCount": 0, + "issueCount": 0, + "featureCount": 18, + "defectCount": 1, + "backlogItemCount": 19 + }, { + "id": "7509", + "name": "Library Service Status System", + "requestCount": 1, + "issueCount": 0, + "featureCount": 34, + "defectCount": 4, + "backlogItemCount": 38 + }, { + "id": "7516", + "name": "Fedora", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "7517", + "name": "Spotlight", + "requestCount": 2, + "issueCount": 0, + "featureCount": 19, + "defectCount": 2, + "backlogItemCount": 21 + }, { + "id": "7529", + "name": "IIIF Generation Service", + "requestCount": 1, + "issueCount": 0, + "featureCount": 2, + "defectCount": 1, + "backlogItemCount": 3 + }, { + "id": "7797", + "name": "chronam", + "requestCount": 1, + "issueCount": 0, + "featureCount": 10, + "defectCount": 2, + "backlogItemCount": 12 + }, { + "id": "7869", + "name": "Cap", + "requestCount": 0, + "issueCount": 0, + "featureCount": 11, + "defectCount": 0, + "backlogItemCount": 11 + }, { + "id": "7934", + "name": "SAGE", + "requestCount": 0, + "issueCount": 0, + "featureCount": 0, + "defectCount": 0, + "backlogItemCount": 0 + }, { + "id": "7948", + "name": "Project Management Service", + "requestCount": 0, + "issueCount": 0, + "featureCount": 17, + "defectCount": 1, + "backlogItemCount": 18 + }] +}; + +angular.module('mock.remoteProjectService', []).service('RemoteProjectsService', function ($q) { + + this.getRemoteProjects = function () { + return mockRemoteProjects; + }; + + this.getByScopeId = function (remoteProjectManagerId, scopeId) { + return $q(function (resolve, reject) { + for (var i in mockRemoteProjects[remoteProjectManagerId]) { + if (mockRemoteProjects[remoteProjectManagerId][i].id === scopeId) { + resolve(mockRemoteProjects[remoteProjectManagerId][i]); + } + } + reject(undefined); + }); + }; + + this.ready = $q.defer().promise; + +}); \ No newline at end of file diff --git a/tests/mocks/services/mockStorageService.js b/tests/mocks/services/mockStorageService.js new file mode 100644 index 0000000..96942e6 --- /dev/null +++ b/tests/mocks/services/mockStorageService.js @@ -0,0 +1,3 @@ +angular.module('mock.storageService', []).service('StorageService', function ($q) { + +}); \ No newline at end of file diff --git a/tests/mocks/services/mockUserService.js b/tests/mocks/services/mockUserService.js new file mode 100644 index 0000000..a67c18c --- /dev/null +++ b/tests/mocks/services/mockUserService.js @@ -0,0 +1,18 @@ +angular.module('mock.userService', []).service('UserService', function ($q) { + + this.userEvents = function () { + var defer = $q.defer(); + return defer.promise; + } + + this.getCurrentUser = function () { + return {}; + } + + this.userReady = function () { + return $q(function (resolve) { + resolve(); + }); + } + +}); \ No newline at end of file diff --git a/tests/mocks/services/mockVersionProjectService.js b/tests/mocks/services/mockVersionProjectService.js deleted file mode 100644 index d2f0d28..0000000 --- a/tests/mocks/services/mockVersionProjectService.js +++ /dev/null @@ -1,15 +0,0 @@ -angular.module('mock.versionProjectService', []).service('VersionProjectService', function ($q) { - - this.getAll = function (vmsId) { - return $q(function (resolve, reject) { - resolve([]); - }); - }; - - this.getByScopeId = function (vmsId, scopeId) { - return $q(function (resolve, reject) { - resolve({}); - }); - }; - -}); \ No newline at end of file diff --git a/tests/mocks/services/mockauthservice.js b/tests/mocks/services/mockauthservice.js old mode 100755 new mode 100644 diff --git a/tests/mocks/services/mockwsapi.js b/tests/mocks/services/mockwsapi.js old mode 100755 new mode 100644 index 863d9f0..b02815f --- a/tests/mocks/services/mockwsapi.js +++ b/tests/mocks/services/mockwsapi.js @@ -2,6 +2,42 @@ angular.module('mock.wsApi', []).service('WsApi', function ($q) { this.fetch = function (apiReq) { var defer = $q.defer(); + if (apiReq === apiMapping.ActiveSprints.all) { + defer.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + }, + payload: { + "ArrayList": mockActiveSprints + } + }) + }); + } + if (apiReq === apiMapping.ProjectsStats.all) { + defer.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + }, + payload: { + "ArrayList": mockProjectsStats + } + }) + }); + } + if (apiReq === apiMapping.RemoteProjects.all) { + defer.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + }, + payload: { + "HashMap": mockRemoteProjects + } + }) + }); + } return defer.promise; } @@ -10,4 +46,5 @@ angular.module('mock.wsApi', []).service('WsApi', function ($q) { return defer.promise; } + }); \ No newline at end of file diff --git a/tests/unit/controllers/activeSprintsControlerTest.js b/tests/unit/controllers/activeSprintsControlerTest.js new file mode 100644 index 0000000..c118655 --- /dev/null +++ b/tests/unit/controllers/activeSprintsControlerTest.js @@ -0,0 +1,100 @@ +describe('controller: ActiveSprintsController', function () { + + var scope, controller; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.activeSprintsService'); + module('mock.statusRepo'); + inject(function ($controller, $sce, $rootScope, _ActiveSprintsService_, _StatusRepo_) { + scope = $rootScope.$new(); + controller = $controller('ActiveSprintsController', { + $scope: scope, + $sce: $sce, + ActiveSprintsService: _ActiveSprintsService_, + StatusRepo: _StatusRepo_ + }); + }); + }); + + describe('Is the controller defined', function () { + it('should be defined', function () { + expect(controller).toBeDefined(); + }); + }); + + describe('Are the scope methods defined', function () { + it('select should be defined', function () { + expect(scope.select).toBeDefined(); + expect(typeof scope.select).toEqual('function'); + }); + it('kanbanHeader should be defined', function () { + expect(scope.kanbanHeader).toBeDefined(); + expect(typeof scope.kanbanHeader).toEqual('function'); + }); + it('getSprintEstimateTotal should be defined', function () { + expect(scope.getSprintEstimateTotal).toBeDefined(); + expect(typeof scope.getSprintEstimateTotal).toEqual('function'); + }); + it('getStatusEstimateTotal should be defined', function () { + expect(scope.getStatusEstimateTotal).toBeDefined(); + expect(typeof scope.getStatusEstimateTotal).toEqual('function'); + }); + it('getAvatarUrl should be defined', function () { + expect(scope.getAvatarUrl).toBeDefined(); + expect(typeof scope.getAvatarUrl).toEqual('function'); + }); + it('getHtmlContent should be defined', function () { + expect(scope.getHtmlContent).toBeDefined(); + expect(typeof scope.getHtmlContent).toEqual('function'); + }); + it('getSelectedSprint should be defined', function () { + expect(scope.getSelectedSprint).toBeDefined(); + expect(typeof scope.getSelectedSprint).toEqual('function'); + }); + }); + + describe('Do the scope methods work as expected', function () { + it('select should set session storage to selected index', function () { + scope.select(0); + expect(Number(sessionStorage.selected)).toEqual(0); + }); + + it('getSprintEstimateTotal should get sprint total estimate', function () { + var total = scope.getSprintEstimateTotal(scope.activeSprints[0]); + expect(total).toEqual(8.5); + }); + + it('getStatusEstimateTotal should get status total estimate', function () { + scope.select(0); + var total = scope.getStatusEstimateTotal({ + "id": 4, + "identifier": "Accepted", + "mapping": ["Accepted"] + }); + expect(total).toEqual(8); + }); + + it('getAvatarUrl should get the member avatar url', function () { + var avatarUrl = scope.getAvatarUrl({ + "id": "6616", + "name": "Ryan Laddusaw", + "avatar": "no_avatar.png" + }); + expect(avatarUrl).toEqual('http://localhost:9001/images/no_avatar.png'); + }); + + it('getHtmlContent should get trusted content', function () { + var html = 'Hello, World!'; + scope.getHtmlContent(html); + }); + + it('getSelectedSprint should get selected sprint', function () { + scope.select(0); + var selectedSprint = scope.getSelectedSprint(); + expect(selectedSprint).toEqual(scope.activeSprints[0]); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/controllers/projectControllerTest.js b/tests/unit/controllers/projectControllerTest.js index 6de0b29..89daf97 100644 --- a/tests/unit/controllers/projectControllerTest.js +++ b/tests/unit/controllers/projectControllerTest.js @@ -1,36 +1,36 @@ describe('controller: ProjectController', function () { - var scope, controller, ProjectRepo, VersionManagementSoftwareRepo; - - beforeEach(module('core')); - beforeEach(module('app')); - beforeEach(module('app/views/modals/addProjectModal.html')); - beforeEach(module('mock.project')); - beforeEach(module('mock.projectRepo')); - beforeEach(module('mock.versionManagementSoftwareRepo')); - beforeEach(module('mock.versionProjectService')); - - beforeEach(inject(function ($controller, $rootScope, $templateCache, _$compile_, _$q_, _$templateRequest_, _ModalService_, _Project_, _ProjectRepo_, _VersionManagementSoftwareRepo_, _VersionProjectService_) { - installPromiseMatchers(); - scope = $rootScope.$new(); - Project = _Project_; - ProjectRepo = _ProjectRepo_; - VersionManagementSoftwareRepo = _VersionManagementSoftwareRepo_; - VersionProjectService = _VersionProjectService_; - $compile = _$compile_; - $q = _$q_; - cache = $templateCache; - controller = $controller('ProjectController', { - $scope: scope, - $compile: _$compile_, - $templateRequest: _$templateRequest_, - ModalService: _ModalService_, - Project: _Project_, - ProjectRepo: _ProjectRepo_, - VersionManagementSoftwareRepo: _VersionManagementSoftwareRepo_, - VersionProjectService: _VersionProjectService_ - }); - })); + var scope, controller, Project, ProjectRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('app/views/modals/addProjectModal.html'); + module('mock.project'); + module('mock.projectRepo'); + module('mock.remoteProjectManagerRepo'); + module('mock.remoteProjectService'); + module('mock.userService'); + inject(function ($controller, $rootScope, $templateCache, _$compile_, _$q_, _$templateRequest_, _ModalService_, _Project_, _ProjectRepo_, _RemoteProjectManagerRepo_, _RemoteProjectsService_, _UserService_) { + scope = $rootScope.$new(); + Project = _Project_; + ProjectRepo = _ProjectRepo_; + $compile = _$compile_; + $q = _$q_; + cache = $templateCache; + controller = $controller('ProjectController', { + $scope: scope, + $compile: _$compile_, + $templateRequest: _$templateRequest_, + ModalService: _ModalService_, + Project: _Project_, + ProjectRepo: _ProjectRepo_, + RemoteProjectManagerRepo: _RemoteProjectManagerRepo_, + RemoteProjectsService: _RemoteProjectsService_, + UserService: _UserService_ + }); + }) + }); describe('Is the controller defined', function () { it('should be defined', function () { @@ -47,9 +47,9 @@ describe('controller: ProjectController', function () { expect(scope.createProject).toBeDefined(); expect(typeof scope.createProject).toEqual('function'); }); - it('cancelCreateProject should be defined', function () { - expect(scope.cancelCreateProject).toBeDefined(); - expect(typeof scope.cancelCreateProject).toEqual('function'); + it('resetCreateProject should be defined', function () { + expect(scope.resetCreateProject).toBeDefined(); + expect(typeof scope.resetCreateProject).toEqual('function'); }); it('editProject should be defined', function () { expect(scope.editProject).toBeDefined(); @@ -105,7 +105,7 @@ describe('controller: ProjectController', function () { expect(ProjectRepo.findById(newProject.id)).toEqual(newProject); }); - it('cancelCreateProject should call resetProjectForms() and clear out the name field', function () { + it('resetCreateProject should call resetProjectForms() and clear out the name field', function () { spyOn(scope, 'resetProjectForms'); var length = mockProjects.length + 1; var newProject = { @@ -118,7 +118,7 @@ describe('controller: ProjectController', function () { scope.$digest(); var form = scope.projectForms.create; form.$setDirty(); - scope.cancelCreateProject(); + scope.resetCreateProject(); expect(scope.projectToCreate.name).toEqual(''); expect(scope.resetProjectForms).toHaveBeenCalled(); diff --git a/tests/unit/controllers/remoteProjectManagerControllerTest.js b/tests/unit/controllers/remoteProjectManagerControllerTest.js new file mode 100644 index 0000000..0375643 --- /dev/null +++ b/tests/unit/controllers/remoteProjectManagerControllerTest.js @@ -0,0 +1,249 @@ +describe('controller: RemoteProjectManagerController', function () { + + var scope, controller, RemoteProjectManager, RemoteProjectManagerRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('app/views/modals/addRemoteProjectManagerModal.html'); + module('mock.remoteProjectManager'); + module('mock.remoteProjectManagerRepo'); + inject(function ($controller, $rootScope, $templateCache, _$compile_, _$filter_, _$q_, _ModalService_, _RemoteProjectManager_, _RemoteProjectManagerRepo_) { + scope = $rootScope.$new(); + $compile = _$compile_; + $q = _$q_; + cache = $templateCache; + RemoteProjectManager = _RemoteProjectManager_; + RemoteProjectManagerRepo = _RemoteProjectManagerRepo_; + controller = $controller('RemoteProjectManagerController', { + $scope: scope, + $compile: _$compile_, + $filter: _$filter_, + ModalService: _ModalService_, + RemoteProjectManagerRepo: _RemoteProjectManagerRepo_ + }); + }) + }); + + describe('Is the controller defined', function () { + it('should be defined', function () { + expect(controller).toBeDefined(); + }); + }); + + describe('Are the scope methods defined', function () { + it('resetRemoteProjectManagerForms should be defined', function () { + expect(scope.resetRemoteProjectManagerForms).toBeDefined(); + expect(typeof scope.resetRemoteProjectManagerForms).toEqual('function'); + }); + it('createRemoteProjectManager should be defined', function () { + expect(scope.createRemoteProjectManager).toBeDefined(); + expect(typeof scope.createRemoteProjectManager).toEqual('function'); + }); + it('resetCreateRemoteProjectManager should be defined', function () { + expect(scope.resetCreateRemoteProjectManager).toBeDefined(); + expect(typeof scope.resetCreateRemoteProjectManager).toEqual('function'); + }); + it('editRemoteProjectManager should be defined', function () { + expect(scope.editRemoteProjectManager).toBeDefined(); + expect(typeof scope.editRemoteProjectManager).toEqual('function'); + }); + it('updateRemoteProjectManager should be defined', function () { + expect(scope.updateRemoteProjectManager).toBeDefined(); + expect(typeof scope.updateRemoteProjectManager).toEqual('function'); + }); + it('cancelEditRemoteProjectManager should be defined', function () { + expect(scope.cancelEditRemoteProjectManager).toBeDefined(); + expect(typeof scope.cancelEditRemoteProjectManager).toEqual('function'); + }); + it('confirmDeleteRemoteProjectManager should be defined', function () { + expect(scope.confirmDeleteRemoteProjectManager).toBeDefined(); + expect(typeof scope.confirmDeleteRemoteProjectManager).toEqual('function'); + }); + it('cancelDeleteRemoteProjectManager should be defined', function () { + expect(scope.cancelDeleteRemoteProjectManager).toBeDefined(); + expect(typeof scope.cancelDeleteRemoteProjectManager).toEqual('function'); + }); + it('deleteRemoteProjectManager should be defined', function () { + expect(scope.deleteRemoteProjectManager).toBeDefined(); + expect(typeof scope.deleteRemoteProjectManager).toEqual('function'); + }); + it('typeSettings should be defined', function () { + expect(scope.typeSettings).toBeDefined(); + expect(typeof scope.typeSettings).toEqual('function'); + }); + }); + + describe('Do the scope methods work as expected', function () { + it('resetRemoteProjectManagerForms should reset Remote Project Manager forms', function () { + + var modal = angular.element(cache.get('app/views/modals/addRemoteProjectManagerModal.html')); + modal = $compile(modal)(scope); + scope.$digest(); + var form = scope.remoteProjectManagerForms.create; + form.$setDirty(); + + expect(form.$dirty).toEqual(true); + + scope.resetRemoteProjectManagerForms(); + + expect(form.$pristine).toEqual(true); + expect(form.$dirty).toEqual(false); + }); + + it('createRemoteProjectManager should create a new Remote Project Manager', function () { + var newRemoteProjectManager = { + "id": 4, + "name": "Test 4", + "type": "VERSION_ONE", + "settings": { + "password": "password4", + "url": "url4", + "username": "username4" + } + }; + scope.remoteProjectManagerToCreate = newRemoteProjectManager; + scope.createRemoteProjectManager(); + + expect(RemoteProjectManagerRepo.findById(newRemoteProjectManager.id)).toEqual(newRemoteProjectManager); + }); + + it('resetCreateRemoteProjectManager should call resetRemoteProjectManagerForms() and clear out the fields', function () { + var newRemoteProjectManager = { + "id": 4, + "name": "Test 4", + "type": "VERSION_ONE", + "settings": { + "password": "password4", + "url": "url4", + "username": "username4" + } + }; + var scaffold = { + "id": "", + "name": "", + "Type": "VERSION_ONE", + "settings": { + "password": "password4", + "url": "url4", + "username": "username4" + } + }; + spyOn(scope, 'resetRemoteProjectManagerForms'); + spyOn(RemoteProjectManagerRepo, 'getScaffold').and.returnValue(scaffold); + + scope.remoteProjectManagerToCreate = newRemoteProjectManager; + scope.resetCreateRemoteProjectManager(); + + expect(scope.remoteProjectManagerToCreate.name).toEqual(''); + expect(scope.resetRemoteProjectManagerForms).toHaveBeenCalled(); + }); + + it('editRemoteProjectManager should set the remoteProjectManagerToEdit and open the modal', function () { + spyOn(scope, 'openModal'); + scope.editRemoteProjectManager(mockRemoteProjectManageres[0]); + + expect(scope.remoteProjectManagerToEdit).toEqual(mockRemoteProjectManageres[0]); + expect(scope.openModal).toHaveBeenCalled(); + }); + + it('updateRemoteProjectManager should call dirty and save on the Remote Project Manager, and then call cancelEditRemoteProjectManager', function () { + spyOn(scope, 'cancelEditRemoteProjectManager'); + spyOn(RemoteProjectManager, 'dirty'); + deferred = $q.defer(); + spyOn(RemoteProjectManager, 'save').and.returnValue(deferred.promise); + scope.remoteProjectManagerToEdit = RemoteProjectManager; + scope.updateRemoteProjectManager(); + deferred.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + } + }) + }); + scope.$apply(); + + expect(scope.cancelEditRemoteProjectManager).toHaveBeenCalled(); + expect(RemoteProjectManager.dirty).toHaveBeenCalledWith(true); + expect(RemoteProjectManager.save).toHaveBeenCalled(); + }); + + it('cancelEditRemoteProjectManager should clear out remoteProjectManagerToEdit and call resetRemoteProjectManagerForms', function () { + spyOn(scope, 'resetRemoteProjectManagerForms'); + scope.remoteProjectManagerToEdit = RemoteProjectManager; + scope.cancelEditRemoteProjectManager(); + + expect(scope.remoteProjectManagerToEdit.name).not.toBeDefined(); + expect(scope.resetRemoteProjectManagerForms).toHaveBeenCalled(); + }); + + it('confirmDeleteRemoteProjectManager should set the remoteProjectManagerToDelete and open the modal', function () { + spyOn(scope, 'openModal'); + scope.confirmDeleteRemoteProjectManager(mockRemoteProjectManageres[0]); + + expect(scope.openModal).toHaveBeenCalled(); + expect(scope.remoteProjectManagerToDelete).toEqual(mockRemoteProjectManageres[0]); + }); + + it('cancelDeleteRemoteProjectManager should clear remoteProjectManagerToDelete and close the modal', function () { + spyOn(scope, 'closeModal'); + scope.remoteProjectManagerToDelete = mockRemoteProjectManageres[0]; + scope.cancelDeleteRemoteProjectManager(); + + expect(scope.closeModal).toHaveBeenCalled(); + expect(scope.remoteProjectManagerToDelete).toEqual({}); + }); + + it('deleteRemoteProjectManager should call the repo delete method and then call cancelDeleteRemoteProjectManager when successful', function () { + scope.remoteProjectManagerToDelete = RemoteProjectManager; + deferred = $q.defer(); + spyOn(RemoteProjectManagerRepo, 'delete').and.returnValue(deferred.promise); + spyOn(scope, 'cancelDeleteRemoteProjectManager'); + scope.deleteRemoteProjectManager(RemoteProjectManager); + deferred.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + } + }) + }); + scope.$apply(); + + expect(RemoteProjectManagerRepo.delete).toHaveBeenCalledWith(RemoteProjectManager); + expect(scope.cancelDeleteRemoteProjectManager).toHaveBeenCalled(); + }); + + it('typeSettings should return appropriate scaffold', function () { + var scaffold = [{ + "type": "text", + "key": "url", + "gloss": "URL", + "visible": true + }, { + "type": "text", + "key": "username", + "gloss": "Username", + "visible": false + }, { + "type": "password", + "key": "password", + "gloss": "Password", + "visible": false + }, { + "type": "password", + "key": "token", + "gloss": "Token", + "visible": false + }]; + scope.serviceTypes = [{ + "gloss": "Version One", + "scaffold": scaffold, + "value": "VERSION_ONE" + }]; + var typeSettings = scope.typeSettings('VERSION_ONE'); + expect(typeSettings).toEqual(scaffold); + }); + + }); + +}); \ No newline at end of file diff --git a/tests/unit/controllers/statusControllerTest.js b/tests/unit/controllers/statusControllerTest.js new file mode 100644 index 0000000..6473a54 --- /dev/null +++ b/tests/unit/controllers/statusControllerTest.js @@ -0,0 +1,209 @@ +describe('controller: StatusController', function () { + + var scope, controller, Status, StatusRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('app/views/modals/addStatusModal.html'); + module('mock.status'); + module('mock.statusRepo'); + inject(function ($controller, $rootScope, $templateCache, _$compile_, _$q_, _Status_, _StatusRepo_) { + scope = $rootScope.$new(); + $compile = _$compile_; + $q = _$q_; + cache = $templateCache; + Status = _Status_; + StatusRepo = _StatusRepo_; + controller = $controller('StatusController', { + $scope: scope, + StatusRepo: _StatusRepo_ + }); + }); + }); + + describe('Is the controller defined', function () { + it('should be defined', function () { + expect(controller).toBeDefined(); + }); + }); + + describe('Are the scope methods defined', function () { + it('resetStatusForms should be defined', function () { + expect(scope.resetStatusForms).toBeDefined(); + expect(typeof scope.resetStatusForms).toEqual('function'); + }); + it('createStatus should be defined', function () { + expect(scope.createStatus).toBeDefined(); + expect(typeof scope.createStatus).toEqual('function'); + }); + it('resetCreateStatus should be defined', function () { + expect(scope.resetCreateStatus).toBeDefined(); + expect(typeof scope.resetCreateStatus).toEqual('function'); + }); + it('editStatus should be defined', function () { + expect(scope.editStatus).toBeDefined(); + expect(typeof scope.editStatus).toEqual('function'); + }); + it('updateStatus should be defined', function () { + expect(scope.updateStatus).toBeDefined(); + expect(typeof scope.updateStatus).toEqual('function'); + }); + it('addMatch should be defined', function () { + expect(scope.addMatch).toBeDefined(); + expect(typeof scope.addMatch).toEqual('function'); + }); + it('removeMatch should be defined', function () { + expect(scope.removeMatch).toBeDefined(); + expect(typeof scope.removeMatch).toEqual('function'); + }); + it('cancelEditStatus should be defined', function () { + expect(scope.cancelEditStatus).toBeDefined(); + expect(typeof scope.cancelEditStatus).toEqual('function'); + }); + it('confirmDeleteStatus should be defined', function () { + expect(scope.confirmDeleteStatus).toBeDefined(); + expect(typeof scope.confirmDeleteStatus).toEqual('function'); + }); + it('cancelDeleteStatus should be defined', function () { + expect(scope.cancelDeleteStatus).toBeDefined(); + expect(typeof scope.cancelDeleteStatus).toEqual('function'); + }); + it('deleteStatus should be defined', function () { + expect(scope.deleteStatus).toBeDefined(); + expect(typeof scope.deleteStatus).toEqual('function'); + }); + }); + + describe('Do the scope methods work as expected', function () { + it('resetStatusForms should reset Status forms', function () { + + var modal = angular.element(cache.get('app/views/modals/addStatusModal.html')); + modal = $compile(modal)(scope); + scope.$digest(); + var form = scope.statusForms.create; + form.$setDirty(); + + expect(form.$dirty).toEqual(true); + + scope.resetStatusForms(); + + expect(form.$pristine).toEqual(true); + expect(form.$dirty).toEqual(false); + }); + + it('createStatus should create a new Status', function () { + var newStatus = { + "id": 5, + "identifier": "Fubar", + "mapping": [ + "Foo", + "Bar" + ] + }; + scope.statusToCreate = newStatus; + scope.createStatus(); + + expect(StatusRepo.findById(newStatus.id)).toEqual(newStatus); + }); + + it('resetCreateStatus should call resetCreateStatus() and clear out the fields', function () { + var newStatus = { + "id": 5, + "identifier": "Fubar", + "mapping": [ + "Foo", + "Bar" + ] + }; + var scaffold = { + "identifier": "", + "mapping": [""] + }; + spyOn(scope, 'resetStatusForms'); + spyOn(StatusRepo, 'getScaffold').and.returnValue(scaffold); + + scope.statusToCreate = newStatus; + scope.resetCreateStatus(); + + expect(scope.resetStatusForms).toHaveBeenCalled(); + expect(scope.statusToCreate.identifier).toEqual(''); + expect(scope.statusToCreate.mapping).toEqual(['']); + }); + + it('editStatus should set the statusToEdit and open the modal', function () { + spyOn(scope, 'openModal'); + scope.editStatus(mockStatuses[0]); + + expect(scope.statusToEdit).toEqual(mockStatuses[0]); + expect(scope.openModal).toHaveBeenCalled(); + }); + + it('updateStatus should call dirty and save on the Status, and then call cancelEditStatus', function () { + spyOn(scope, 'cancelEditStatus'); + spyOn(Status, 'dirty'); + deferred = $q.defer(); + spyOn(Status, 'save').and.returnValue(deferred.promise); + scope.statusToEdit = Status; + scope.updateStatus(); + deferred.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + } + }) + }); + scope.$apply(); + + expect(scope.cancelEditStatus).toHaveBeenCalled(); + expect(Status.dirty).toHaveBeenCalledWith(true); + expect(Status.save).toHaveBeenCalled(); + }); + + it('cancelEditStatus should clear out statusToEdit and call resetStatusForms', function () { + spyOn(scope, 'resetStatusForms'); + scope.statusToEdit = Status; + scope.cancelEditStatus(); + + expect(scope.statusToEdit.identifier).not.toBeDefined(); + expect(scope.resetStatusForms).toHaveBeenCalled(); + }); + + it('confirmDeleteStatus should set the statusToDelete and open the modal', function () { + spyOn(scope, 'openModal'); + scope.confirmDeleteStatus(mockStatuses[0]); + + expect(scope.openModal).toHaveBeenCalled(); + expect(scope.statusToDelete).toEqual(mockStatuses[0]); + }); + + it('cancelDeleteStatus should clear statusToDelete and close the modal', function () { + spyOn(scope, 'closeModal'); + scope.statusToDelete = mockStatuses[0]; + scope.cancelDeleteStatus(); + + expect(scope.closeModal).toHaveBeenCalled(); + expect(scope.statusToDelete).toEqual({}); + }); + + it('deleteStatus should call the repo delete method and then call cancelDeleteStatus when successful', function () { + scope.statusToDelete = Status; + deferred = $q.defer(); + spyOn(StatusRepo, 'delete').and.returnValue(deferred.promise); + spyOn(scope, 'cancelDeleteStatus'); + scope.deleteStatus(Status); + deferred.resolve({ + body: angular.toJson({ + meta: { + status: "SUCCESS" + } + }) + }); + scope.$apply(); + + expect(StatusRepo.delete).toHaveBeenCalledWith(Status); + expect(scope.cancelDeleteStatus).toHaveBeenCalled(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/controllers/userControllerTest.js b/tests/unit/controllers/userControllerTest.js deleted file mode 100755 index 901a5f0..0000000 --- a/tests/unit/controllers/userControllerTest.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('controller: UserController', function () { - - beforeEach(module('core')); - - beforeEach(module('app')); - -}); \ No newline at end of file diff --git a/tests/unit/controllers/userRepoControllerTest.js b/tests/unit/controllers/userRepoControllerTest.js old mode 100755 new mode 100644 index 478727c..573e447 --- a/tests/unit/controllers/userRepoControllerTest.js +++ b/tests/unit/controllers/userRepoControllerTest.js @@ -1,7 +1,26 @@ describe('controller: UserRepoController', function () { - beforeEach(module('core')); + var scope, controller; - beforeEach(module('app')); + beforeEach(function () { + module('core'); + module('app'); + module('mock.storageService'); + module('mock.userService'); + inject(function ($controller, $rootScope, _StorageService_, _UserService_) { + scope = $rootScope.$new(); + controller = $controller('UserRepoController', { + $scope: scope, + StorageService: _StorageService_, + UserService: _UserService_ + }); + }); + }); + + describe('Is the controller defined', function () { + it('should be defined', function () { + expect(controller).toBeDefined(); + }); + }); }); \ No newline at end of file diff --git a/tests/unit/controllers/versionManagementSoftwareTest.js b/tests/unit/controllers/versionManagementSoftwareTest.js deleted file mode 100644 index c81f685..0000000 --- a/tests/unit/controllers/versionManagementSoftwareTest.js +++ /dev/null @@ -1,210 +0,0 @@ -describe('controller: VersionManagementSoftwareController', function () { - - var scope, controller; - - beforeEach(module('core')); - beforeEach(module('app')); - beforeEach(module('app/views/modals/addVmsModal.html')); - beforeEach(module('mock.versionManagementSoftware')); - beforeEach(module('mock.versionManagementSoftwareRepo')); - - beforeEach(inject(function ($controller, $rootScope, $templateCache, _$compile_, _$filter_, _$q_, _ModalService_, _VersionManagementSoftware_, _VersionManagementSoftwareRepo_) { - installPromiseMatchers(); - scope = $rootScope.$new(); - $compile = _$compile_; - $q = _$q_; - cache = $templateCache; - VersionManagementSoftware = _VersionManagementSoftware_; - VersionManagementSoftwareRepo = _VersionManagementSoftwareRepo_; - controller = $controller('VersionManagementSoftwareController', { - $scope: scope, - $compile: _$compile_, - $filter: _$filter_, - ModalService: _ModalService_, - VersionManagementSoftware: _VersionManagementSoftware_, - VersionManagementSoftwareRepo: _VersionManagementSoftwareRepo_ - }); - })); - - describe('Is the controller defined', function () { - it('should be defined', function () { - expect(controller).toBeDefined(); - }); - }); - - describe('Are the scope methods defined', function () { - it('resetVmsForms should be defined', function () { - expect(scope.resetVmsForms).toBeDefined(); - expect(typeof scope.resetVmsForms).toEqual('function'); - }); - it('createVms should be defined', function () { - expect(scope.createVms).toBeDefined(); - expect(typeof scope.createVms).toEqual('function'); - }); - it('cancelCreateVms should be defined', function () { - expect(scope.cancelCreateVms).toBeDefined(); - expect(typeof scope.cancelCreateVms).toEqual('function'); - }); - it('editVms should be defined', function () { - expect(scope.editVms).toBeDefined(); - expect(typeof scope.editVms).toEqual('function'); - }); - it('updateVms should be defined', function () { - expect(scope.updateVms).toBeDefined(); - expect(typeof scope.updateVms).toEqual('function'); - }); - it('cancelEditVms should be defined', function () { - expect(scope.cancelEditVms).toBeDefined(); - expect(typeof scope.cancelEditVms).toEqual('function'); - }); - it('confirmDeleteVms should be defined', function () { - expect(scope.confirmDeleteVms).toBeDefined(); - expect(typeof scope.confirmDeleteVms).toEqual('function'); - }); - it('cancelDeleteVms should be defined', function () { - expect(scope.cancelDeleteVms).toBeDefined(); - expect(typeof scope.cancelDeleteVms).toEqual('function'); - }); - it('deleteVms should be defined', function () { - expect(scope.deleteVms).toBeDefined(); - expect(typeof scope.deleteVms).toEqual('function'); - }); - }); - - describe('Do the scope methods work as expected', function () { - it('resetVmsForms should reset Version Management Software forms', function () { - - var modal = angular.element(cache.get('app/views/modals/addVmsModal.html')); - modal = $compile(modal)(scope); - scope.$digest(); - var form = scope.vmsForms.create; - form.$setDirty(); - - expect(form.$dirty).toEqual(true); - - scope.resetVmsForms(); - - expect(form.$pristine).toEqual(true); - expect(form.$dirty).toEqual(false); - }); - - it('createVms should create a new Version Management Software', function () { - var length = mockVmses.length + 1; - var newVms = { - "id": 4, - "name": "Test 4", - "type": "VERSION_ONE", - "settings": { - "password": "password4", - "url": "url4", - "username": "username4" - } - }; - scope.vmsToCreate = newVms; - scope.createVms(); - - expect(VersionManagementSoftwareRepo.findById(newVms.id)).toEqual(newVms); - }); - - it('cancelCreateVms should call resetVmsForms() and clear out the fields', function () { - var newVms = { - "id": 4, - "name": "Test 4", - "type": "VERSION_ONE", - "settings": { - "password": "password4", - "url": "url4", - "username": "username4" - } - }; - var scaffold = { - "id": "", - "name": "", - "Type": "VERSION_ONE", - "settings": { - "password": "password4", - "url": "url4", - "username": "username4" - } - }; - spyOn(scope, 'resetVmsForms'); - spyOn(VersionManagementSoftwareRepo, 'getScaffold').and.returnValue(scaffold); - - scope.vmsToCreate = newVms; - scope.cancelCreateVms(); - - expect(scope.vmsToCreate.name).toEqual(''); - expect(scope.resetVmsForms).toHaveBeenCalled(); - }); - - it('editVms should set the vmsToEdit and open the modal', function () { - spyOn(scope, 'openModal'); - scope.editVms(mockVmses[0]); - - expect(scope.vmsToEdit).toEqual(mockVmses[0]); - expect(scope.openModal).toHaveBeenCalled(); - }); - - it('updateVms should call dirty and save on the VMS, and then call cancelEditVms', function () { - spyOn(scope, 'cancelEditVms'); - spyOn(VersionManagementSoftware, 'dirty'); - deferred = $q.defer(); - spyOn(VersionManagementSoftware, 'save').and.returnValue(deferred.promise); - scope.vmsToEdit = VersionManagementSoftware; - scope.updateVms(); - deferred.resolve(); - scope.$apply(); - - expect(scope.cancelEditVms).toHaveBeenCalled(); - expect(VersionManagementSoftware.dirty).toHaveBeenCalledWith(true); - expect(VersionManagementSoftware.save).toHaveBeenCalled(); - }); - - it('cancelEditVms should clear out vmsToEdit and call resetVmsForms', function () { - spyOn(scope, 'resetVmsForms'); - scope.vmsToEdit = VersionManagementSoftware; - scope.cancelEditVms(); - - expect(scope.vmsToEdit.name).not.toBeDefined(); - expect(scope.resetVmsForms).toHaveBeenCalled(); - }); - - it('confirmDeleteVms should set the vmsToDelete and open the modal', function () { - spyOn(scope, 'openModal'); - scope.confirmDeleteVms(mockVmses[0]); - - expect(scope.openModal).toHaveBeenCalled(); - expect(scope.vmsToDelete).toEqual(mockVmses[0]); - }); - - it('cancelDeleteVms should clear vmsToDelete and close the modal', function () { - spyOn(scope, 'closeModal'); - scope.vmsToDelete = mockVmses[0]; - scope.cancelDeleteVms(); - - expect(scope.closeModal).toHaveBeenCalled(); - expect(scope.vmsToDelete).toEqual({}); - }); - - it('deleteVms should call the repo delete method and then call cancelDeleteVms when successful', function () { - scope.vmsToDelete = Project; - deferred = $q.defer(); - spyOn(VersionManagementSoftwareRepo, 'delete').and.returnValue(deferred.promise); - spyOn(scope, 'cancelDeleteVms'); - scope.deleteVms(VersionManagementSoftware); - deferred.resolve({ - body: angular.toJson({ - meta: { - status: "SUCCESS" - } - }) - }); - scope.$apply(); - - expect(VersionManagementSoftwareRepo.delete).toHaveBeenCalledWith(VersionManagementSoftware); - expect(scope.cancelDeleteVms).toHaveBeenCalled(); - }); - - }); - -}); \ No newline at end of file diff --git a/tests/unit/directives/customHeaderDirectiveTest.js b/tests/unit/directives/customHeaderDirectiveTest.js new file mode 100644 index 0000000..f02b0f8 --- /dev/null +++ b/tests/unit/directives/customHeaderDirectiveTest.js @@ -0,0 +1,15 @@ +describe('directive: customHeader', function () { + + var scope, element; + + beforeEach(function () { + module('core'); + module('app'); + module('views/directives/header.html'); + inject(function ($rootScope, _$compile_) { + scope = $rootScope.$new(); + $compile = _$compile_; + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/directives/remoteProjectManagerFormDirectiveTest.js b/tests/unit/directives/remoteProjectManagerFormDirectiveTest.js new file mode 100644 index 0000000..68b2fd1 --- /dev/null +++ b/tests/unit/directives/remoteProjectManagerFormDirectiveTest.js @@ -0,0 +1,43 @@ +describe('directive: remoteProjectManagerForm', function () { + + var scope, element; + + beforeEach(function () { + module('core'); + module('app'); + module('views/directives/remoteProjectManagerForm.html'); + inject(function ($rootScope, _$compile_) { + scope = $rootScope.$new(); + $compile = _$compile_; + + scope.model = { + name: '', + type: '' + }; + scope.settings = [{ + "type": "text", + "key": "url", + "gloss": "URL", + "visible": true + }, { + "type": "text", + "key": "username", + "gloss": "Username", + "visible": false + }, { + "type": "password", + "key": "password", + "gloss": "Password", + "visible": false + }, { + "type": "password", + "key": "token", + "gloss": "Token", + "visible": false + }]; + element = $compile('')(scope); + scope.$apply(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/model/abstractAppModelTest.js b/tests/unit/model/abstractAppModelTest.js new file mode 100644 index 0000000..423ecda --- /dev/null +++ b/tests/unit/model/abstractAppModelTest.js @@ -0,0 +1,23 @@ +describe('model: AbstractAppModel', function () { + + var AbstractAppModel; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _AbstractAppModel_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + AbstractAppModel = _AbstractAppModel_; + }); + }); + + describe('Is the model defined', function () { + it('should be defined', function () { + expect(AbstractAppModel).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/model/projectTest.js b/tests/unit/model/projectTest.js new file mode 100644 index 0000000..5287348 --- /dev/null +++ b/tests/unit/model/projectTest.js @@ -0,0 +1,23 @@ +describe('model: Project', function () { + + var Project; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _Project_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + Project = _Project_; + }); + }); + + describe('Is the model defined', function () { + it('should be defined', function () { + expect(Project).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/model/remoteProjectManagerTetst.js b/tests/unit/model/remoteProjectManagerTetst.js new file mode 100644 index 0000000..6c8b43f --- /dev/null +++ b/tests/unit/model/remoteProjectManagerTetst.js @@ -0,0 +1,23 @@ +describe('model: RemoteProjectManager', function () { + + var RemoteProjectManager; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _RemoteProjectManager_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + RemoteProjectManager = _RemoteProjectManager_; + }); + }); + + describe('Is the model defined', function () { + it('should be defined', function () { + expect(RemoteProjectManager).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/model/statusTest.js b/tests/unit/model/statusTest.js new file mode 100644 index 0000000..b8a0665 --- /dev/null +++ b/tests/unit/model/statusTest.js @@ -0,0 +1,23 @@ +describe('model: Status', function () { + + var Status; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _Status_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + Status = _Status_; + }); + }); + + describe('Is the model defined', function () { + it('should be defined', function () { + expect(Status).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/models/assumedControlModelTest.js b/tests/unit/models/assumedControlModelTest.js deleted file mode 100755 index f3255e9..0000000 --- a/tests/unit/models/assumedControlModelTest.js +++ /dev/null @@ -1,15 +0,0 @@ -describe('model: AssumedControl', function () { - - var AssumedControl; - - beforeEach(module('core')); - - beforeEach(module('app')); - - beforeEach(module('AssumedControl')); - - beforeEach(inject(function (_AssumedControl_) { - AssumedControl = _AssumedControl_; - })); - -}); \ No newline at end of file diff --git a/tests/unit/models/userModelTest.js b/tests/unit/models/userModelTest.js deleted file mode 100755 index e8988e0..0000000 --- a/tests/unit/models/userModelTest.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('model: User', function () { - - beforeEach(module('core')); - - beforeEach(module('app')); - -}); \ No newline at end of file diff --git a/tests/unit/models/userRepoModelTest.js b/tests/unit/models/userRepoModelTest.js deleted file mode 100755 index 4b829c0..0000000 --- a/tests/unit/models/userRepoModelTest.js +++ /dev/null @@ -1,7 +0,0 @@ -describe('model: UserRepo', function () { - - beforeEach(module('core')); - - beforeEach(module('app')); - -}); \ No newline at end of file diff --git a/tests/unit/repo/abstractAppRepoTest.js b/tests/unit/repo/abstractAppRepoTest.js new file mode 100644 index 0000000..1405652 --- /dev/null +++ b/tests/unit/repo/abstractAppRepoTest.js @@ -0,0 +1,23 @@ +describe('repo: AbstractAppRepo', function () { + + var AbstractAppRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _AbstractAppRepo_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + AbstractAppRepo = _AbstractAppRepo_; + }); + }); + + describe('Is the repo defined', function () { + it('should be defined', function () { + expect(AbstractAppRepo).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/repo/projectRepoTest.js b/tests/unit/repo/projectRepoTest.js new file mode 100644 index 0000000..e16b72a --- /dev/null +++ b/tests/unit/repo/projectRepoTest.js @@ -0,0 +1,23 @@ +describe('repo: ProjectRepo', function () { + + var ProjectRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _ProjectRepo_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + ProjectRepo = _ProjectRepo_; + }); + }); + + describe('Is the repo defined', function () { + it('should be defined', function () { + expect(ProjectRepo).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/repo/remoteProjectManagerRepoTest.js b/tests/unit/repo/remoteProjectManagerRepoTest.js new file mode 100644 index 0000000..72dbedd --- /dev/null +++ b/tests/unit/repo/remoteProjectManagerRepoTest.js @@ -0,0 +1,23 @@ +describe('repo: RemoteProjectManagerRepo', function () { + + var RemoteProjectManagerRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _RemoteProjectManagerRepo_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + RemoteProjectManagerRepo = _RemoteProjectManagerRepo_; + }); + }); + + describe('Is the repo defined', function () { + it('should be defined', function () { + expect(RemoteProjectManagerRepo).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/repo/statusRepoTest.js b/tests/unit/repo/statusRepoTest.js new file mode 100644 index 0000000..3229636 --- /dev/null +++ b/tests/unit/repo/statusRepoTest.js @@ -0,0 +1,23 @@ +describe('repo: StatusRepo', function () { + + var StatusRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _StatusRepo_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + StatusRepo = _StatusRepo_; + }); + }); + + describe('Is the repo defined', function () { + it('should be defined', function () { + expect(StatusRepo).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/repo/userRepoTest.js b/tests/unit/repo/userRepoTest.js new file mode 100644 index 0000000..616e82f --- /dev/null +++ b/tests/unit/repo/userRepoTest.js @@ -0,0 +1,23 @@ +describe('repo: UserRepo', function () { + + var UserRepo; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _UserRepo_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + UserRepo = _UserRepo_; + }); + }); + + describe('Is the repo defined', function () { + it('should be defined', function () { + expect(UserRepo).toBeDefined(); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/services/activeSprintsServiceTest.js b/tests/unit/services/activeSprintsServiceTest.js new file mode 100644 index 0000000..2c694ab --- /dev/null +++ b/tests/unit/services/activeSprintsServiceTest.js @@ -0,0 +1,56 @@ +describe('service: ActiveSprintsService', function () { + + var ActiveSprintsService; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + inject(function (_$rootScope_, _$q_, _WsApi_, _ActiveSprintsService_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + ActiveSprintsService = _ActiveSprintsService_; + }); + }); + + describe('Is the service defined', function () { + it('should be defined', function () { + expect(ActiveSprintsService).toBeDefined(); + }); + }); + + describe('Are the service methods defined', function () { + it('refreshActiveSprints should be defined', function () { + expect(ActiveSprintsService.refreshActiveSprints).toBeDefined(); + expect(typeof ActiveSprintsService.refreshActiveSprints).toEqual('function'); + }); + it('getActiveSprints should be defined', function () { + expect(ActiveSprintsService.getActiveSprints).toBeDefined(); + expect(typeof ActiveSprintsService.getActiveSprints).toEqual('function'); + }); + }); + + describe('Are the service properties defined', function () { + it('updated should be defined', function () { + expect(ActiveSprintsService.updated).toBeDefined(); + expect(typeof ActiveSprintsService.updated).toEqual('object'); + }); + }); + + describe('Do the service methods work as expected', function () { + it('refreshActiveSprints should fetch active sprints', function () { + deferred = $q.defer(); + spyOn(WsApi, 'fetch').and.returnValue(deferred.promise); + ActiveSprintsService.refreshActiveSprints(); + deferred.resolve(mockActiveSprints); + expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.ActiveSprints.all); + }); + it('getActiveSprints should get active sprints', function () { + $rootScope.$apply(); + var activeSprints = ActiveSprintsService.getActiveSprints(); + expect(activeSprints).toEqual(mockActiveSprints); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/services/projectsStatsServiceTest.js b/tests/unit/services/projectsStatsServiceTest.js new file mode 100644 index 0000000..a6cdcde --- /dev/null +++ b/tests/unit/services/projectsStatsServiceTest.js @@ -0,0 +1,70 @@ +describe('service: ProjectsStatsService', function () { + + var ProjectsStatsService; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + module('mock.projectRepo'); + inject(function (_$rootScope_, _$q_, _WsApi_, _ProjectRepo_, _ProjectsStatsService_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + ProjectRepo = _ProjectRepo_; + ProjectsStatsService = _ProjectsStatsService_; + }); + }); + + describe('Is the service defined', function () { + it('should be defined', function () { + expect(ProjectsStatsService).toBeDefined(); + }); + }); + + describe('Are the service methods defined', function () { + it('refreshProjectsStats should be defined', function () { + expect(ProjectsStatsService.refreshProjectsStats).toBeDefined(); + expect(typeof ProjectsStatsService.refreshProjectsStats).toEqual('function'); + }); + it('getProjectsStats should be defined', function () { + expect(ProjectsStatsService.getProjectsStats).toBeDefined(); + expect(typeof ProjectsStatsService.getProjectsStats).toEqual('function'); + }); + it('getById should be defined', function () { + expect(ProjectsStatsService.getById).toBeDefined(); + expect(typeof ProjectsStatsService.getById).toEqual('function'); + }); + }); + + describe('Are the service properties defined', function () { + it('ready should be defined', function () { + expect(ProjectsStatsService.ready).toBeDefined(); + expect(typeof ProjectsStatsService.ready).toEqual('object'); + }); + }); + + describe('Do the service methods work as expected', function () { + it('refreshProjectsStats should fetch project stats', function () { + deferred = $q.defer(); + spyOn(WsApi, 'fetch').and.returnValue(deferred.promise); + ProjectsStatsService.refreshProjectsStats(); + deferred.resolve(mockProjectsStats); + expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.ProjectsStats.all); + }); + it('getProjectsStats should get project stats', function () { + spyOn(ProjectRepo, 'reset'); + $rootScope.$apply(); + var projectsStats = ProjectsStatsService.getProjectsStats(); + expect(projectsStats).toEqual(mockProjectsStats); + expect(ProjectRepo.reset).toHaveBeenCalled(); + }); + it('getById should get project stats by id', function () { + $rootScope.$apply(); + ProjectsStatsService.getById(1).then(function (projectStats) { + expect(projectStats).toEqual(mockProjectsStats[0]); + }); + }); + }); + +}); \ No newline at end of file diff --git a/tests/unit/services/remoteProjectsServiceTest.js b/tests/unit/services/remoteProjectsServiceTest.js new file mode 100644 index 0000000..88313f3 --- /dev/null +++ b/tests/unit/services/remoteProjectsServiceTest.js @@ -0,0 +1,70 @@ +describe('service: RemoteProjectsService', function () { + + var RemoteProjectsService; + + beforeEach(function () { + module('core'); + module('app'); + module('mock.wsApi'); + module('mock.projectRepo'); + inject(function (_$rootScope_, _$q_, _WsApi_, _ProjectRepo_, _RemoteProjectsService_) { + $rootScope = _$rootScope_; + $q = _$q_; + WsApi = _WsApi_; + ProjectRepo = _ProjectRepo_; + RemoteProjectsService = _RemoteProjectsService_; + }); + }); + + describe('Is the service defined', function () { + it('should be defined', function () { + expect(RemoteProjectsService).toBeDefined(); + }); + }); + + describe('Are the service methods defined', function () { + it('refreshRemoteProjects should be defined', function () { + expect(RemoteProjectsService.refreshRemoteProjects).toBeDefined(); + expect(typeof RemoteProjectsService.refreshRemoteProjects).toEqual('function'); + }); + it('getRemoteProjects should be defined', function () { + expect(RemoteProjectsService.getRemoteProjects).toBeDefined(); + expect(typeof RemoteProjectsService.getRemoteProjects).toEqual('function'); + }); + it('getByScopeId should be defined', function () { + expect(RemoteProjectsService.getByScopeId).toBeDefined(); + expect(typeof RemoteProjectsService.getByScopeId).toEqual('function'); + }); + }); + + describe('Are the service properties defined', function () { + it('ready should be defined', function () { + expect(RemoteProjectsService.ready).toBeDefined(); + expect(typeof RemoteProjectsService.ready).toEqual('object'); + }); + }); + + describe('Do the service methods work as expected', function () { + it('refreshRemoteProjects should fetch remote projects', function () { + deferred = $q.defer(); + spyOn(WsApi, 'fetch').and.returnValue(deferred.promise); + RemoteProjectsService.refreshRemoteProjects(); + deferred.resolve(mockRemoteProjects); + expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.RemoteProjects.all); + }); + it('getRemoteProjects should get remote projects', function () { + spyOn(ProjectRepo, 'reset'); + $rootScope.$apply(); + var remoteProjects = RemoteProjectsService.getRemoteProjects(); + expect(remoteProjects).toEqual(mockRemoteProjects); + expect(ProjectRepo.reset).toHaveBeenCalled(); + }); + it('getByScopeId should get remote project by remote project manager id and scope id', function () { + $rootScope.$apply(); + RemoteProjectsService.getByScopeId(1, 1934).then(function (remoteProject) { + expect(remoteProject).toEqual(mockRemoteProjects['1'][0]); + }); + }); + }); + +}); \ No newline at end of file