From 0fd33e818fa07bd1338895fc86ed6bf82048fc78 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 24 Apr 2020 13:52:49 -0500 Subject: [PATCH] Issue 60: Refactor project to product --- README.md | 6 +- app/.htaccess | 4 +- app/config/apiMapping.js | 46 ++--- app/config/routes.js | 4 +- app/controllers/activeSprintsController.js | 4 +- app/controllers/productController.js | 106 +++++------ .../remoteProductManagerController.js | 90 ++++----- .../remoteProductManagerFormDirective.js | 6 +- app/index.html | 26 +-- app/model/product.js | 30 +-- app/model/remoteProductManager.js | 6 +- app/repo/productRepo.js | 4 +- app/repo/remoteProductManagerRepo.js | 8 +- app/services/productStatsService.js | 30 +-- app/services/remoteProductService.js | 36 ++-- .../directives/remoteProductManagerForm.html | 4 +- app/views/home.html | 28 +-- app/views/management.html | 6 +- app/views/management/products.html | 34 ++-- .../management/remoteProductManager.html | 28 +-- app/views/modals/addProductModal.html | 28 +-- .../modals/addRemoteProductManagerModal.html | 20 +- app/views/modals/deleteProductModal.html | 10 +- .../deleteRemoteProductManagerModal.html | 10 +- app/views/modals/editProductModal.html | 32 ++-- .../modals/editRemoteProductManagerModal.html | 20 +- package-lock.json | 2 +- package.json | 10 +- tests/e2e/protractor.conf.js | 2 +- tests/mock/model/mockProduct.js | 30 +-- tests/mock/model/mockRemoteProductManager.js | 18 +- tests/mock/repo/mockProductRepo.js | 30 +-- .../mock/repo/mockRemoteProductManagerRepo.js | 28 +-- .../mock/service/mockActiveSprintsService.js | 2 +- tests/mock/service/mockProductStatsService.js | 26 +-- .../mock/service/mockRemoteProductService.js | 20 +- tests/mock/service/mockWsApi.js | 8 +- .../unit/controllers/productControllerTest.js | 180 +++++++++--------- .../remoteProductManagerControllerTest.js | 156 +++++++-------- .../remoteProductManagerFormDirectiveTest.js | 6 +- tests/unit/model/productTest.js | 6 +- tests/unit/model/remoteProductManagerTest.js | 6 +- tests/unit/repo/productRepoTest.js | 6 +- .../unit/repo/remoteProductManagerRepoTest.js | 6 +- .../unit/services/productsStatsServiceTest.js | 38 ++-- .../unit/services/remoteProductServiceTest.js | 38 ++-- 46 files changed, 622 insertions(+), 622 deletions(-) diff --git a/README.md b/README.md index 2966f0a..718b0f8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/TAMULib/ProjectManagementUI.svg?branch=master)](https://travis-ci.org/TAMULib/ProjectManagementUI) -[![Coverage Status](https://coveralls.io/repos/github/TAMULib/ProjectManagementUI/badge.svg?branch=master)](https://coveralls.io/github/TAMULib/ProjectManagementUI?branch=master) +[![Build Status](https://travis-ci.org/TAMULib/ProductManagementUI.svg?branch=master)](https://travis-ci.org/TAMULib/ProductManagementUI) +[![Coverage Status](https://coveralls.io/repos/github/TAMULib/ProductManagementUI/badge.svg?branch=master)](https://coveralls.io/github/TAMULib/ProductManagementUI?branch=master) -# Project Management UI +# Product Management UI diff --git a/app/.htaccess b/app/.htaccess index a58e764..78fc7d0 100644 --- a/app/.htaccess +++ b/app/.htaccess @@ -1,7 +1,7 @@ RewriteEngine On - RewriteBase /projects/ + RewriteBase /products/ RewriteCond %{HTTP:X-Requested-With} !XMLHttpRequest$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.html [L] - \ No newline at end of file + diff --git a/app/config/apiMapping.js b/app/config/apiMapping.js index 45ec0dc..d0333b0 100644 --- a/app/config/apiMapping.js +++ b/app/config/apiMapping.js @@ -1,36 +1,36 @@ // CONVENTION: must match model name, case sensitive var apiMapping = { - Project: { + Product: { validations: true, lazy: true, - channel: '/channel/projects', + channel: '/channel/products', all: { 'endpoint': '/private/queue', - 'controller': 'projects', + 'controller': 'products', 'method': '', 'httpMethod': 'GET' }, create: { 'endpoint': '/private/queue', - 'controller': 'projects', + 'controller': 'products', 'method': '', 'httpMethod': 'POST' }, update: { 'endpoint': '/private/queue', - 'controller': 'projects', + 'controller': 'products', 'method': '', 'httpMethod': 'PUT' }, remove: { 'endpoint': '/private/queue', - 'controller': 'projects', + 'controller': 'products', 'method': '', 'httpMethod': 'DELETE' }, listen: { 'endpoint': '/channel', - 'controller': 'projects' + 'controller': 'products' } }, User: { @@ -55,47 +55,47 @@ var apiMapping = { 'method': 'update' } }, - RemoteProjectManager: { + RemoteProductManager: { validations: true, lazy: true, - channel: '/channel/remote-project-manager', + channel: '/channel/remote-product-manager', all: { 'endpoint': '/private/queue', - 'controller': 'remote-project-manager', + 'controller': 'remote-product-manager', 'method': '', 'httpMethod': 'GET' }, create: { 'endpoint': '/private/queue', - 'controller': 'remote-project-manager', + 'controller': 'remote-product-manager', 'method': '', 'httpMethod': 'POST' }, update: { 'endpoint': '/private/queue', - 'controller': 'remote-project-manager', + 'controller': 'remote-product-manager', 'method': '', 'httpMethod': 'PUT' }, remove: { 'endpoint': '/private/queue', - 'controller': 'remote-project-manager', + 'controller': 'remote-product-manager', 'method': '', 'httpMethod': 'DELETE' }, listen: { 'endpoint': '/channel', - 'controller': 'remote-project-manager' + 'controller': 'remote-product-manager' }, types: { 'endpoint': '/channel', - 'controller': 'remote-project-manager', + 'controller': 'remote-product-manager', 'method': 'types/', 'httpMethod': 'GET' }, scaffolding: { 'endpoint': '/channel', - 'controller': 'remote-project-manager', + 'controller': 'remote-product-manager', 'method': 'scaffolding/:type/', 'httpMethod': 'GET' } @@ -133,24 +133,24 @@ var apiMapping = { 'controller': 'status' } }, - RemoteProjects: { + RemoteProducts: { all: { 'endpoint': '/private/queue', - 'controller': 'projects/remote' + 'controller': 'products/remote' }, listen: { 'endpoint': '/channel', - 'controller': 'projects/remote' + 'controller': 'products/remote' } }, - ProjectsStats: { + ProductsStats: { all: { 'endpoint': '/private/queue', - 'controller': 'projects/stats' + 'controller': 'products/stats' }, listen: { 'endpoint': '/channel', - 'controller': 'projects/stats' + 'controller': 'products/stats' } }, ActiveSprints: { @@ -163,4 +163,4 @@ var apiMapping = { 'controller': 'sprints/active' } } -}; \ No newline at end of file +}; diff --git a/app/config/routes.js b/app/config/routes.js index 612db6b..7e15694 100644 --- a/app/config/routes.js +++ b/app/config/routes.js @@ -1,7 +1,7 @@ app.config(function ($routeProvider) { $routeProvider. when('/management', { - redirectTo: '/management/projects' + redirectTo: '/management/products' }). when('/management/:tab', { templateUrl: 'views/management.html', @@ -31,4 +31,4 @@ app.config(function ($routeProvider) { otherwise({ redirectTo: '/error/404' }); -}); \ No newline at end of file +}); diff --git a/app/controllers/activeSprintsController.js b/app/controllers/activeSprintsController.js index d32855c..bd9fc41 100644 --- a/app/controllers/activeSprintsController.js +++ b/app/controllers/activeSprintsController.js @@ -19,7 +19,7 @@ app.controller('ActiveSprintsController', function ($controller, $sce, $scope, A }; $scope.kanbanHeader = function () { - return $scope.getSelectedSprint() ? $scope.getSelectedSprint().project + ": " + $scope.getSelectedSprint().name : "Select Sprint Above"; + return $scope.getSelectedSprint() ? $scope.getSelectedSprint().product + ": " + $scope.getSelectedSprint().name : "Select Sprint Above"; }; $scope.getSprintEstimateTotal = function (sprint) { @@ -76,4 +76,4 @@ app.controller('ActiveSprintsController', function ($controller, $sce, $scope, A } }); -}); \ No newline at end of file +}); diff --git a/app/controllers/productController.js b/app/controllers/productController.js index e37d08c..0b9f118 100644 --- a/app/controllers/productController.js +++ b/app/controllers/productController.js @@ -1,105 +1,105 @@ -app.controller('ProjectController', function ($controller, $scope, ApiResponseActions, ProjectRepo, RemoteProjectManagerRepo, RemoteProjectsService) { +app.controller('ProductController', function ($controller, $scope, ApiResponseActions, ProductRepo, RemoteProductManagerRepo, RemoteProductsService) { angular.extend(this, $controller('AbstractController', { $scope: $scope })); - $scope.projects = ProjectRepo.getAll(); + $scope.products = ProductRepo.getAll(); - $scope.projectToCreate = ProjectRepo.getScaffold(); + $scope.productToCreate = ProductRepo.getScaffold(); - $scope.projectToDelete = {}; + $scope.productToDelete = {}; - $scope.projectForms = { - validations: ProjectRepo.getValidations(), - getResults: ProjectRepo.getValidationResults + $scope.productForms = { + validations: ProductRepo.getValidations(), + getResults: ProductRepo.getValidationResults }; - $scope.resetProjectForms = function () { - ProjectRepo.clearValidationResults(); - for (var key in $scope.projectForms) { - if ($scope.projectForms[key] !== undefined && !$scope.projectForms[key].$pristine && $scope.projectForms[key].$setPristine) { - $scope.projectForms[key].$setPristine(); + $scope.resetProductForms = function () { + ProductRepo.clearValidationResults(); + for (var key in $scope.productForms) { + if ($scope.productForms[key] !== undefined && !$scope.productForms[key].$pristine && $scope.productForms[key].$setPristine) { + $scope.productForms[key].$setPristine(); } } $scope.closeModal(); }; - $scope.resetProjectForms(); + $scope.resetProductForms(); - $scope.createProject = function () { - ProjectRepo.create($scope.projectToCreate).then(function (res) { + $scope.createProduct = function () { + ProductRepo.create($scope.productToCreate).then(function (res) { if (angular.fromJson(res.body).meta.status === 'SUCCESS') { - $scope.resetCreateProject(); + $scope.resetCreateProduct(); } }); }; - $scope.resetCreateProject = function () { - angular.extend($scope.projectToCreate, ProjectRepo.getScaffold()); - $scope.resetProjectForms(); + $scope.resetCreateProduct = function () { + angular.extend($scope.productToCreate, ProductRepo.getScaffold()); + $scope.resetProductForms(); }; - $scope.editProject = function (project) { - $scope.projectToEdit = project; - $scope.openModal('#editProjectModal'); + $scope.editProduct = function (product) { + $scope.productToEdit = product; + $scope.openModal('#editProductModal'); }; - $scope.updateProject = function () { - $scope.projectToEdit.dirty(true); - $scope.projectToEdit.save().then(function () { - $scope.cancelEditProject(); + $scope.updateProduct = function () { + $scope.productToEdit.dirty(true); + $scope.productToEdit.save().then(function () { + $scope.cancelEditProduct(); }); }; - $scope.cancelEditProject = function () { - $scope.projectToEdit.refresh(); - $scope.projectToEdit = {}; - $scope.resetProjectForms(); + $scope.cancelEditProduct = function () { + $scope.productToEdit.refresh(); + $scope.productToEdit = {}; + $scope.resetProductForms(); }; - $scope.confirmDeleteProject = function (project) { - $scope.projectToDelete = project; - $scope.openModal('#deleteProjectModal'); + $scope.confirmDeleteProduct = function (product) { + $scope.productToDelete = product; + $scope.openModal('#deleteProductModal'); }; - $scope.cancelDeleteProject = function () { - $scope.projectToDelete = {}; + $scope.cancelDeleteProduct = function () { + $scope.productToDelete = {}; $scope.closeModal(); }; - $scope.deleteProject = function (project) { - ProjectRepo.delete(project).then(function (res) { + $scope.deleteProduct = function (product) { + ProductRepo.delete(product).then(function (res) { if (angular.fromJson(res.body).meta.status === "SUCCESS") { - $scope.cancelDeleteProject(); + $scope.cancelDeleteProduct(); } }); }; if ($scope.isManager() || $scope.isAdmin()) { - $scope.remoteProjectManagers = RemoteProjectManagerRepo.getAll(); + $scope.remoteProductManagers = RemoteProductManagerRepo.getAll(); - $scope.remoteProjects = RemoteProjectsService.getRemoteProjects(); + $scope.remoteProducts = RemoteProductsService.getRemoteProducts(); - $scope.getRemoteProjectManagerRemoteProjects = function (remoteProjectManagerId) { - return $scope.remoteProjects[remoteProjectManagerId]; + $scope.getRemoteProductManagerRemoteProducts = function (remoteProductManagerId) { + return $scope.remoteProducts[remoteProductManagerId]; }; - 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]); + RemoteProductManagerRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.remoteProductManagers.length = 0; + var remoteProductManagers = RemoteProductManagerRepo.getAll(); + for (var i in remoteProductManagers) { + $scope.remoteProductManagers.push(remoteProductManagers[i]); } }); } - 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]); + ProductRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.products.length = 0; + var products = ProductRepo.getAll(); + for (var i in products) { + $scope.products.push(products[i]); } }); -}); \ No newline at end of file +}); diff --git a/app/controllers/remoteProductManagerController.js b/app/controllers/remoteProductManagerController.js index affc44a..a084124 100644 --- a/app/controllers/remoteProductManagerController.js +++ b/app/controllers/remoteProductManagerController.js @@ -1,82 +1,82 @@ -app.controller('RemoteProjectManagerController', function ($controller, $scope, ApiResponseActions, RemoteProjectManagerRepo) { +app.controller('RemoteProductManagerController', function ($controller, $scope, ApiResponseActions, RemoteProductManagerRepo) { angular.extend(this, $controller('AbstractController', { $scope: $scope })); - $scope.remoteProjectManagers = RemoteProjectManagerRepo.getAll(); + $scope.remoteProductManagers = RemoteProductManagerRepo.getAll(); - $scope.remoteProjectManagerToCreate = RemoteProjectManagerRepo.getScaffold(); + $scope.remoteProductManagerToCreate = RemoteProductManagerRepo.getScaffold(); - $scope.remoteProjectManagerToEdit = {}; - $scope.remoteProjectManagerToDelete = {}; + $scope.remoteProductManagerToEdit = {}; + $scope.remoteProductManagerToDelete = {}; - RemoteProjectManagerRepo.getTypes().then(function (types) { + RemoteProductManagerRepo.getTypes().then(function (types) { $scope.serviceTypes = types; - $scope.resetRemoteProjectManagerForms(); + $scope.resetRemoteProductManagerForms(); }); - $scope.remoteProjectManagerForms = { - validations: RemoteProjectManagerRepo.getValidations(), - getResults: RemoteProjectManagerRepo.getValidationResults + $scope.remoteProductManagerForms = { + validations: RemoteProductManagerRepo.getValidations(), + getResults: RemoteProductManagerRepo.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.resetRemoteProductManagerForms = function () { + RemoteProductManagerRepo.clearValidationResults(); + for (var key in $scope.remoteProductManagerForms) { + if ($scope.remoteProductManagerForms[key] !== undefined && !$scope.remoteProductManagerForms[key].$pristine && $scope.remoteProductManagerForms[key].$setPristine) { + $scope.remoteProductManagerForms[key].$setPristine(); } } $scope.closeModal(); }; - $scope.createRemoteProjectManager = function () { - RemoteProjectManagerRepo.create($scope.remoteProjectManagerToCreate).then(function (res) { + $scope.createRemoteProductManager = function () { + RemoteProductManagerRepo.create($scope.remoteProductManagerToCreate).then(function (res) { if (angular.fromJson(res.body).meta.status === 'SUCCESS') { - $scope.resetCreateRemoteProjectManager(); + $scope.resetCreateRemoteProductManager(); } }); }; - $scope.resetCreateRemoteProjectManager = function () { - $scope.remoteProjectManagerToCreate = RemoteProjectManagerRepo.getScaffold(); - $scope.resetRemoteProjectManagerForms(); + $scope.resetCreateRemoteProductManager = function () { + $scope.remoteProductManagerToCreate = RemoteProductManagerRepo.getScaffold(); + $scope.resetRemoteProductManagerForms(); }; - $scope.editRemoteProjectManager = function (remoteProjectManager) { - $scope.remoteProjectManagerToEdit = angular.copy(remoteProjectManager); - $scope.openModal('#editRemoteProjectManagerModal'); + $scope.editRemoteProductManager = function (remoteProductManager) { + $scope.remoteProductManagerToEdit = angular.copy(remoteProductManager); + $scope.openModal('#editRemoteProductManagerModal'); }; - $scope.updateRemoteProjectManager = function () { - $scope.remoteProjectManagerToEdit.dirty(true); - $scope.remoteProjectManagerToEdit.save().then(function (res) { + $scope.updateRemoteProductManager = function () { + $scope.remoteProductManagerToEdit.dirty(true); + $scope.remoteProductManagerToEdit.save().then(function (res) { if (angular.fromJson(res.body).meta.status === "SUCCESS") { - $scope.cancelEditRemoteProjectManager(); + $scope.cancelEditRemoteProductManager(); } }); }; - $scope.cancelEditRemoteProjectManager = function () { - $scope.remoteProjectManagerToEdit.refresh(); - $scope.resetRemoteProjectManagerForms(); + $scope.cancelEditRemoteProductManager = function () { + $scope.remoteProductManagerToEdit.refresh(); + $scope.resetRemoteProductManagerForms(); }; - $scope.confirmDeleteRemoteProjectManager = function (remoteProjectManager) { - $scope.remoteProjectManagerToDelete = remoteProjectManager; - $scope.openModal('#deleteRemoteProjectManagerModal'); + $scope.confirmDeleteRemoteProductManager = function (remoteProductManager) { + $scope.remoteProductManagerToDelete = remoteProductManager; + $scope.openModal('#deleteRemoteProductManagerModal'); }; - $scope.cancelDeleteRemoteProjectManager = function () { - $scope.remoteProjectManagerToDelete = {}; + $scope.cancelDeleteRemoteProductManager = function () { + $scope.remoteProductManagerToDelete = {}; $scope.closeModal(); }; - $scope.deleteRemoteProjectManager = function (remoteProjectManager) { - RemoteProjectManagerRepo.delete(remoteProjectManager).then(function (res) { + $scope.deleteRemoteProductManager = function (remoteProductManager) { + RemoteProductManagerRepo.delete(remoteProductManager).then(function (res) { if (angular.fromJson(res.body).meta.status === 'SUCCESS') { - $scope.cancelDeleteRemoteProjectManager(); + $scope.cancelDeleteRemoteProductManager(); } }); }; @@ -90,12 +90,12 @@ app.controller('RemoteProjectManagerController', function ($controller, $scope, 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]); + RemoteProductManagerRepo.listen([ApiResponseActions.CREATE, ApiResponseActions.DELETE, ApiResponseActions.UPDATE], function () { + $scope.remoteProductManagers.length = 0; + var remoteProductManagers = RemoteProductManagerRepo.getAll(); + for (var i in remoteProductManagers) { + $scope.remoteProductManagers.push(remoteProductManagers[i]); } }); -}); \ No newline at end of file +}); diff --git a/app/directives/remoteProductManagerFormDirective.js b/app/directives/remoteProductManagerFormDirective.js index 7cdf011..ed415cf 100644 --- a/app/directives/remoteProductManagerFormDirective.js +++ b/app/directives/remoteProductManagerFormDirective.js @@ -1,6 +1,6 @@ -app.directive('remoteProjectManagerForm', function () { +app.directive('remoteProductManagerForm', function () { return { - templateUrl: 'views/directives/remoteProjectManagerForm.html', + templateUrl: 'views/directives/remoteProductManagerForm.html', restrict: 'E', replace: false, scope: { @@ -55,4 +55,4 @@ app.directive('remoteProjectManagerForm', function () { }; } }; -}); \ No newline at end of file +}); diff --git a/app/index.html b/app/index.html index 7782293..6685890 100644 --- a/app/index.html +++ b/app/index.html @@ -7,7 +7,7 @@ - + @@ -15,7 +15,7 @@ - Project Management :: Texas A&M Libraries + Product Management :: Texas A&M Libraries @@ -38,7 +38,7 @@
- + @@ -193,11 +193,11 @@ - + - - + + @@ -206,22 +206,22 @@ - + - + - - + + - + - + @@ -246,4 +246,4 @@ - \ No newline at end of file + diff --git a/app/model/product.js b/app/model/product.js index 88755e9..5d1bb9c 100644 --- a/app/model/product.js +++ b/app/model/product.js @@ -1,28 +1,28 @@ -app.model("Project", function Project(ProjectsStatsService, RemoteProjectsService) { - return function Project() { +app.model("Product", function Product(ProductsStatsService, RemoteProductsService) { + return function Product() { - var project = this; + var product = this; - project.before(function () { - if (project.remoteProjectManager && project.scopeId) { - ProjectsStatsService.getById(project.id).then(function (projectStats) { - angular.extend(project, { - stats: projectStats + product.before(function () { + if (product.remoteProductManager && product.scopeId) { + ProductsStatsService.getById(product.id).then(function (productStats) { + angular.extend(product, { + stats: productStats }); }); } }); - project.before(function () { - if (project.remoteProjectManager && project.scopeId) { - RemoteProjectsService.getByScopeId(project.remoteProjectManager.id, project.scopeId).then(function (remoteProject) { - angular.extend(project, { - remoteProject: remoteProject + product.before(function () { + if (product.remoteProductManager && product.scopeId) { + RemoteProductsService.getByScopeId(product.remoteProductManager.id, product.scopeId).then(function (remoteProduct) { + angular.extend(product, { + remoteProduct: remoteProduct }); }); } }); - return project; + return product; }; -}); \ No newline at end of file +}); diff --git a/app/model/remoteProductManager.js b/app/model/remoteProductManager.js index 694a7c6..d734468 100644 --- a/app/model/remoteProductManager.js +++ b/app/model/remoteProductManager.js @@ -1,5 +1,5 @@ -app.model("RemoteProjectManager", function RemoteProjectManager() { - return function RemoteProjectManager() { +app.model("RemoteProductManager", function RemoteProductManager() { + return function RemoteProductManager() { return this; }; -}); \ No newline at end of file +}); diff --git a/app/repo/productRepo.js b/app/repo/productRepo.js index e4e42ec..e0afb16 100644 --- a/app/repo/productRepo.js +++ b/app/repo/productRepo.js @@ -1,4 +1,4 @@ -app.repo("ProjectRepo", function ProjectRepo() { +app.repo("ProductRepo", function ProductRepo() { this.scaffold = { name: '' @@ -6,4 +6,4 @@ app.repo("ProjectRepo", function ProjectRepo() { return this; -}); \ No newline at end of file +}); diff --git a/app/repo/remoteProductManagerRepo.js b/app/repo/remoteProductManagerRepo.js index 3819d51..1f54d88 100644 --- a/app/repo/remoteProductManagerRepo.js +++ b/app/repo/remoteProductManagerRepo.js @@ -1,4 +1,4 @@ -app.repo("RemoteProjectManagerRepo", function RemoteProjectManagerRepo($q, WsApi) { +app.repo("RemoteProductManagerRepo", function RemoteProductManagerRepo($q, WsApi) { this.scaffold = { name: '', @@ -7,7 +7,7 @@ app.repo("RemoteProjectManagerRepo", function RemoteProjectManagerRepo($q, WsApi this.getTypes = function () { return $q(function (resolve, reject) { - WsApi.fetch(apiMapping.RemoteProjectManager.types).then(function (res) { + WsApi.fetch(apiMapping.RemoteProductManager.types).then(function (res) { var apiRes = angular.fromJson(res.body); if (apiRes.meta.status === 'SUCCESS') { resolve(apiRes.payload['ArrayList']); @@ -21,7 +21,7 @@ app.repo("RemoteProjectManagerRepo", function RemoteProjectManagerRepo($q, WsApi this.getTypeScaffolding = function (type) { return $q(function (resolve, reject) { if (type !== undefined) { - WsApi.fetch(apiMapping.RemoteProjectManager.scaffolding, { + WsApi.fetch(apiMapping.RemoteProductManager.scaffolding, { pathValues: { type: type } @@ -39,4 +39,4 @@ app.repo("RemoteProjectManagerRepo", function RemoteProjectManagerRepo($q, WsApi return this; -}); \ No newline at end of file +}); diff --git a/app/services/productStatsService.js b/app/services/productStatsService.js index 93aa278..0cf9aca 100644 --- a/app/services/productStatsService.js +++ b/app/services/productStatsService.js @@ -1,49 +1,49 @@ -app.service('ProjectsStatsService', function ($q, ProjectRepo, WsApi) { +app.service('ProductsStatsService', function ($q, ProductRepo, WsApi) { - var projectsStats = []; + var productsStats = []; 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']); + angular.extend(productsStats, apiRes.payload['ArrayList']); defer.resolve(); - ProjectRepo.reset(); + ProductRepo.reset(); } else { console.error(apiRes.meta); - throw "Unable to retrieve remote projects"; + throw "Unable to retrieve remote products"; } }; - WsApi.listen(apiMapping.ProjectsStats.listen).then(null, null, function (response) { + WsApi.listen(apiMapping.ProductsStats.listen).then(null, null, function (response) { process(response); }); - this.refreshProjectsStats = function () { - WsApi.fetch(apiMapping.ProjectsStats.all).then(function (response) { + this.refreshProductsStats = function () { + WsApi.fetch(apiMapping.ProductsStats.all).then(function (response) { process(response); }); }; - this.getProjectsStats = function () { - return projectsStats; + this.getProductsStats = function () { + return productsStats; }; 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]); + for (var i in productsStats) { + if (productsStats[i].id == id) { + resolve(productsStats[i]); } } }); }.bind(this)); }; - this.refreshProjectsStats(); + this.refreshProductsStats(); this.ready = defer.promise; -}); \ No newline at end of file +}); diff --git a/app/services/remoteProductService.js b/app/services/remoteProductService.js index 11b259c..5802f36 100644 --- a/app/services/remoteProductService.js +++ b/app/services/remoteProductService.js @@ -1,52 +1,52 @@ -app.service('RemoteProjectsService', function ($q, ProjectRepo, WsApi) { +app.service('RemoteProductsService', function ($q, ProductRepo, WsApi) { - var remoteProjects = {}; + var remoteProducts = {}; 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; + for (var key in remoteProducts) { + remoteProducts[key] = undefined; } - angular.extend(remoteProjects, apiRes.payload.HashMap); + angular.extend(remoteProducts, apiRes.payload.HashMap); defer.resolve(); - ProjectRepo.reset(); + ProductRepo.reset(); } else { console.error(apiRes.meta); - throw "Unable to retrieve remote projects"; + throw "Unable to retrieve remote products"; } }; - WsApi.listen(apiMapping.RemoteProjects.listen).then(null, null, function (response) { + WsApi.listen(apiMapping.RemoteProducts.listen).then(null, null, function (response) { process(response); }); - this.refreshRemoteProjects = function () { - WsApi.fetch(apiMapping.RemoteProjects.all).then(function (response) { + this.refreshRemoteProducts = function () { + WsApi.fetch(apiMapping.RemoteProducts.all).then(function (response) { process(response); }); }; - this.getRemoteProjects = function () { - return remoteProjects; + this.getRemoteProducts = function () { + return remoteProducts; }; - this.getByScopeId = function (remoteProjectManagerId, scopeId) { + this.getByScopeId = function (remoteProductManagerId, 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]); + for (var i in remoteProducts[remoteProductManagerId]) { + if (remoteProducts[remoteProductManagerId][i].id === scopeId) { + resolve(remoteProducts[remoteProductManagerId][i]); } } }); }.bind(this)); }; - this.refreshRemoteProjects(); + this.refreshRemoteProducts(); this.ready = defer.promise; -}); \ No newline at end of file +}); diff --git a/app/views/directives/remoteProductManagerForm.html b/app/views/directives/remoteProductManagerForm.html index edd17ad..fd1ed78 100644 --- a/app/views/directives/remoteProductManagerForm.html +++ b/app/views/directives/remoteProductManagerForm.html @@ -1,6 +1,6 @@
- +
@@ -10,4 +10,4 @@ Use token auth
- \ No newline at end of file + diff --git a/app/views/home.html b/app/views/home.html index 11a7f99..98c83b0 100644 --- a/app/views/home.html +++ b/app/views/home.html @@ -7,7 +7,7 @@ Active Sprints
  • - Projects + Products

  • @@ -22,7 +22,7 @@ Id Name - Project + Product Number of Cards Total Points @@ -31,7 +31,7 @@ {{sprint.id}} {{sprint.name}} - {{sprint.project}} + {{sprint.product}} {{sprint.cards.length}} {{getSprintEstimateTotal(sprint)}} @@ -85,25 +85,25 @@ -
    +
    - +
    - + - - - - - - - + + + + + + +
    ProjectProduct Total Backlog Items Feature Count Defect Count Request Count Issue Count
    {{project.name}}{{project.stats.backlogItemCount}}{{project.stats.featureCount}}{{project.stats.defectCount}}{{project.stats.requestCount}}{{project.stats.issueCount}}
    {{product.name}}{{product.stats.backlogItemCount}}{{product.stats.featureCount}}{{product.stats.defectCount}}{{product.stats.requestCount}}{{product.stats.issueCount}}
    @@ -113,4 +113,4 @@
    -
    \ No newline at end of file + diff --git a/app/views/management.html b/app/views/management.html index 37495df..ea555d6 100644 --- a/app/views/management.html +++ b/app/views/management.html @@ -3,9 +3,9 @@
    - Projects + Products Statuses - Remote Progect Managers + Remote Progect Managers Users @@ -13,4 +13,4 @@
    - \ No newline at end of file + diff --git a/app/views/management/products.html b/app/views/management/products.html index a543305..e7f71e4 100644 --- a/app/views/management/products.html +++ b/app/views/management/products.html @@ -1,29 +1,29 @@ -
    +
    - +
    - +
    - - - + + + - - - - - + + + + +
    ProjectRemote Project ManagerRemote ProjectProductRemote Product ManagerRemote Product Scope Id Actions
    {{project.name}}{{project.remoteProjectManager.name}}{{project.remoteProject.name}}{{project.scopeId}}
    {{product.name}}{{product.remoteProductManager.name}}{{product.remoteProduct.name}}{{product.scopeId}} - - + +
    - - - -
    \ No newline at end of file + + + +
    diff --git a/app/views/management/remoteProductManager.html b/app/views/management/remoteProductManager.html index a98978d..3974930 100644 --- a/app/views/management/remoteProductManager.html +++ b/app/views/management/remoteProductManager.html @@ -1,32 +1,32 @@ -
    +
    - +
    - +
    - + - - + +
    Remote Project ManagerRemote Product Manager Settings Actions
    {{remoteProjectManager.name}}
    {{remoteProductManager.name}}
      -
    • +
    • -  {{remoteProjectManager.settings[setting.key]}} +  {{remoteProductManager.settings[setting.key]}}
    - - + +
    - - - -
    \ No newline at end of file + + + +
    diff --git a/app/views/modals/addProductModal.html b/app/views/modals/addProductModal.html index 931a612..e4f9c1c 100644 --- a/app/views/modals/addProductModal.html +++ b/app/views/modals/addProductModal.html @@ -1,36 +1,36 @@ -
    + - + -
    \ No newline at end of file + diff --git a/app/views/modals/addRemoteProductManagerModal.html b/app/views/modals/addRemoteProductManagerModal.html index ff8e9cc..3a9f9f1 100644 --- a/app/views/modals/addRemoteProductManagerModal.html +++ b/app/views/modals/addRemoteProductManagerModal.html @@ -1,24 +1,24 @@ -
    + - + -
    \ No newline at end of file + diff --git a/app/views/modals/deleteProductModal.html b/app/views/modals/deleteProductModal.html index 609f0e0..450614d 100644 --- a/app/views/modals/deleteProductModal.html +++ b/app/views/modals/deleteProductModal.html @@ -1,14 +1,14 @@ -
    + -
    \ No newline at end of file + diff --git a/app/views/modals/deleteRemoteProductManagerModal.html b/app/views/modals/deleteRemoteProductManagerModal.html index 12e8fc8..ee45107 100644 --- a/app/views/modals/deleteRemoteProductManagerModal.html +++ b/app/views/modals/deleteRemoteProductManagerModal.html @@ -1,16 +1,16 @@ -
    + -
    \ No newline at end of file + diff --git a/app/views/modals/editProductModal.html b/app/views/modals/editProductModal.html index 3c28168..11c2057 100644 --- a/app/views/modals/editProductModal.html +++ b/app/views/modals/editProductModal.html @@ -1,38 +1,38 @@ -
    + - + -
    \ No newline at end of file + diff --git a/app/views/modals/editRemoteProductManagerModal.html b/app/views/modals/editRemoteProductManagerModal.html index cb4102a..accccac 100644 --- a/app/views/modals/editRemoteProductManagerModal.html +++ b/app/views/modals/editRemoteProductManagerModal.html @@ -1,24 +1,24 @@ -
    + - + -
    \ No newline at end of file + diff --git a/package-lock.json b/package-lock.json index 2ef7b44..ee18683 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "project-management", + "name": "product-management", "version": "0.2.0", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index 10945fd..2f79e4a 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { - "name": "project-management", + "name": "product-management", "private": false, "version": "0.2.0", - "description": "A UI for managing projects", - "repository": "https://github.com/TAMULib/ProjectManagementUI.git", + "description": "A UI for managing products", + "repository": "https://github.com/TAMULib/ProductManagementUI.git", "license": "MIT", "scripts": { "pretest": "npm install", @@ -16,8 +16,8 @@ "preprotractor": "npm run update-webdriver", "protractor": "protractor e2e-tests/protractor.conf.js", "stop": "wvr server --stop", - "start": "wvr server -b /projects --prod --uid project-management-webserver", - "start:dev": "wvr server -b /projects --uid project-management-webserver" + "start": "wvr server -b /products --prod --uid product-management-webserver", + "start:dev": "wvr server -b /products --uid product-management-webserver" }, "dependencies": { "ng-file-upload": "12.2.13", diff --git a/tests/e2e/protractor.conf.js b/tests/e2e/protractor.conf.js index 6e7eb01..30ce19f 100644 --- a/tests/e2e/protractor.conf.js +++ b/tests/e2e/protractor.conf.js @@ -1,6 +1,6 @@ exports.config = { seleniumAddress: "http://localhost:4444/wd/hub", - baseUrl: "http://localhost/projects/", + baseUrl: "http://localhost/products/", specs: [ "index-spec.js", "auth-spec.js", diff --git a/tests/mock/model/mockProduct.js b/tests/mock/model/mockProduct.js index 244e61b..a0d73e5 100644 --- a/tests/mock/model/mockProduct.js +++ b/tests/mock/model/mockProduct.js @@ -1,9 +1,9 @@ -var dataProject1 = { +var dataProduct1 = { id: 1, - name: "Project 1", - remoteProjectManager: { + name: "Product 1", + remoteProductManager: { id: 1, - name: "Remote Project Manager 1", + name: "Remote Product Manager 1", settings: { password: "password1", url: "url1", @@ -14,12 +14,12 @@ var dataProject1 = { scopeId: "scope 1" }; -var dataProject2 = { +var dataProduct2 = { id: 2, - name: "Project 2", - remoteProjectManager: { + name: "Product 2", + remoteProductManager: { id: 1, - name: "Remote Project Manager 1", + name: "Remote Product Manager 1", settings: { password: "password1", url: "url1", @@ -30,12 +30,12 @@ var dataProject2 = { scopeId: "scope 2" }; -var dataProject3 = { +var dataProduct3 = { id: 3, - name: "Project 3", - remoteProjectManager: { + name: "Product 3", + remoteProductManager: { id: 1, - name: "Remote Project Manager 1", + name: "Remote Product Manager 1", settings: { password: "password1", url: "url1", @@ -46,10 +46,10 @@ var dataProject3 = { scopeId: "scope 3" }; -var mockProject = function ($q) { - var model = mockModel("Project", $q, dataProject1); +var mockProduct = function ($q) { + var model = mockModel("Product", $q, dataProduct1); return model; }; -angular.module("mock.project", []).service("Project", mockProject); +angular.module("mock.product", []).service("Product", mockProduct); diff --git a/tests/mock/model/mockRemoteProductManager.js b/tests/mock/model/mockRemoteProductManager.js index 5abad38..96fdbe3 100644 --- a/tests/mock/model/mockRemoteProductManager.js +++ b/tests/mock/model/mockRemoteProductManager.js @@ -1,6 +1,6 @@ -var dataRemoteProjectManager1 = { +var dataRemoteProductManager1 = { id: 1, - name: "Remote Project Manager 1", + name: "Remote Product Manager 1", settings: { password: "password1", url: "url1", @@ -9,9 +9,9 @@ var dataRemoteProjectManager1 = { type: "VERSION_ONE" }; -var dataRemoteProjectManager2 = { +var dataRemoteProductManager2 = { id: 2, - name: "Remote Project Manager 2", + name: "Remote Product Manager 2", settings: { password: "password2", url: "url2", @@ -20,9 +20,9 @@ var dataRemoteProjectManager2 = { type: "VERSION_ONE" }; -var dataRemoteProjectManager3 = { +var dataRemoteProductManager3 = { id: 3, - name: "Remote Project Manager 3", + name: "Remote Product Manager 3", settings: { password: "password3", url: "url3", @@ -31,10 +31,10 @@ var dataRemoteProjectManager3 = { type: "VERSION_ONE" }; -var mockRemoteProjectManager = function ($q) { - var model = mockModel("RemoteProjectManager", $q, dataRemoteProjectManager1); +var mockRemoteProductManager = function ($q) { + var model = mockModel("RemoteProductManager", $q, dataRemoteProductManager1); return model; }; -angular.module("mock.remoteProjectManager", []).service("RemoteProjectManager", mockRemoteProjectManager); +angular.module("mock.remoteProductManager", []).service("RemoteProductManager", mockRemoteProductManager); diff --git a/tests/mock/repo/mockProductRepo.js b/tests/mock/repo/mockProductRepo.js index a4dd2a4..a037d17 100644 --- a/tests/mock/repo/mockProductRepo.js +++ b/tests/mock/repo/mockProductRepo.js @@ -1,23 +1,23 @@ -var dataProjectRepo1 = [ - dataProject1, - dataProject2, - dataProject3 +var dataProductRepo1 = [ + dataProduct1, + dataProduct2, + dataProduct3 ]; -var dataProjectRepo2 = [ - dataProject3, - dataProject2, - dataProject1 +var dataProductRepo2 = [ + dataProduct3, + dataProduct2, + dataProduct1 ]; -var dataProjectRepo3 = [ - dataProject1, - dataProject3, - dataProject2 +var dataProductRepo3 = [ + dataProduct1, + dataProduct3, + dataProduct2 ]; -angular.module("mock.projectRepo", []).service("ProjectRepo", function ($q) { - var repo = mockRepo("ProjectRepo", $q, mockProject, dataProjectRepo1); +angular.module("mock.productRepo", []).service("ProductRepo", function ($q) { + var repo = mockRepo("ProductRepo", $q, mockProduct, dataProductRepo1); repo.scaffold = { name: '' @@ -27,7 +27,7 @@ angular.module("mock.projectRepo", []).service("ProjectRepo", function ($q) { name: { required: { type: "required", - message: "A Project requires a name", + message: "A Product requires a name", property: "name", value: true } diff --git a/tests/mock/repo/mockRemoteProductManagerRepo.js b/tests/mock/repo/mockRemoteProductManagerRepo.js index 56c27d1..370cf22 100644 --- a/tests/mock/repo/mockRemoteProductManagerRepo.js +++ b/tests/mock/repo/mockRemoteProductManagerRepo.js @@ -1,23 +1,23 @@ -var dataRemoteProjectManagerRepo1 = [ - dataRemoteProjectManager1, - dataRemoteProjectManager2, - dataRemoteProjectManager3 +var dataRemoteProductManagerRepo1 = [ + dataRemoteProductManager1, + dataRemoteProductManager2, + dataRemoteProductManager3 ]; -var dataRemoteProjectManagerRepo2 = [ - dataRemoteProjectManager3, - dataRemoteProjectManager2, - dataRemoteProjectManager1 +var dataRemoteProductManagerRepo2 = [ + dataRemoteProductManager3, + dataRemoteProductManager2, + dataRemoteProductManager1 ]; -var dataRemoteProjectManagerRepo3 = [ - dataRemoteProjectManager1, - dataRemoteProjectManager3, - dataRemoteProjectManager2 +var dataRemoteProductManagerRepo3 = [ + dataRemoteProductManager1, + dataRemoteProductManager3, + dataRemoteProductManager2 ]; -angular.module("mock.remoteProjectManagerRepo", []).service("RemoteProjectManagerRepo", function ($q) { - var repo = mockRepo("RemoteProjectManagerRepo", $q, mockRemoteProjectManager, dataRemoteProjectManagerRepo1); +angular.module("mock.remoteProductManagerRepo", []).service("RemoteProductManagerRepo", function ($q) { + var repo = mockRepo("RemoteProductManagerRepo", $q, mockRemoteProductManager, dataRemoteProductManagerRepo1); repo.scaffold = { name: '', diff --git a/tests/mock/service/mockActiveSprintsService.js b/tests/mock/service/mockActiveSprintsService.js index 84d4e08..63a432b 100644 --- a/tests/mock/service/mockActiveSprintsService.js +++ b/tests/mock/service/mockActiveSprintsService.js @@ -1,7 +1,7 @@ var mockActiveSprints = [{ id: "7820", name: "Sprint 3", - project: "chronam", + product: "chronam", cards: [{ id: 7802, number: "B-03351", diff --git a/tests/mock/service/mockProductStatsService.js b/tests/mock/service/mockProductStatsService.js index 291f906..bc44595 100644 --- a/tests/mock/service/mockProductStatsService.js +++ b/tests/mock/service/mockProductStatsService.js @@ -1,4 +1,4 @@ -var dataProjectsStats = [{ +var dataProductsStats = [{ id: 1, name: "Legacy DSpace", requestCount: 22, @@ -184,7 +184,7 @@ var dataProjectsStats = [{ backlogItemCount: 0 }, { id: 24, - name: "Legacy Projects", + name: "Legacy Products", requestCount: 0, issueCount: 0, featureCount: 0, @@ -448,7 +448,7 @@ var dataProjectsStats = [{ backlogItemCount: 0 }, { id: 57, - name: "Project Management Service", + name: "Product Management Service", requestCount: 0, issueCount: 0, featureCount: 17, @@ -456,28 +456,28 @@ var dataProjectsStats = [{ backlogItemCount: 18 }]; -angular.module("mock.projectsStatsService", []).service("ProjectsStatsService", function ($q) { +angular.module("mock.productsStatsService", []).service("ProductsStatsService", function ($q) { var service = mockService($q); - var projectsStats = dataProjectsStats; + var productsStats = dataProductsStats; - service.dataProjectsStats = function (toMock) { + service.dataProductsStats = function (toMock) { if (typeof toMock === "object") { - projectsStats = toMock; + productsStats = toMock; } else { - projectsStats = dataProjectsStats; + productsStats = dataProductsStats; } }; - service.getProjectsStats = function () { - return projectsStats; + service.getProductsStats = function () { + return productsStats; }; service.getById = function (id) { return $q(function (resolve, reject) { - for (var i in projectsStats) { - if (projectsStats[i].id == id) { - resolve(projectsStats[i]); + for (var i in productsStats) { + if (productsStats[i].id == id) { + resolve(productsStats[i]); } } reject(undefined); diff --git a/tests/mock/service/mockRemoteProductService.js b/tests/mock/service/mockRemoteProductService.js index b04e537..3490ec2 100644 --- a/tests/mock/service/mockRemoteProductService.js +++ b/tests/mock/service/mockRemoteProductService.js @@ -1,4 +1,4 @@ -var dataRemoteProjects = { +var dataRemoteProducts = { 1: [{ id: 1934, name: "Legacy DSpace", @@ -185,7 +185,7 @@ var dataRemoteProjects = { backlogItemCount: 0 }, { id: 5524, - name: "Legacy Projects", + name: "Legacy Products", requestCount: 0, issueCount: 0, featureCount: 0, @@ -449,7 +449,7 @@ var dataRemoteProjects = { backlogItemCount: 0 }, { id: 7948, - name: "Project Management Service", + name: "Product Management Service", requestCount: 0, issueCount: 0, featureCount: 17, @@ -458,18 +458,18 @@ var dataRemoteProjects = { }] }; -angular.module("mock.remoteProjectService", []).service("RemoteProjectsService", function ($q) { +angular.module("mock.remoteProductService", []).service("RemoteProductsService", function ($q) { var service = mockService($q); - service.getRemoteProjects = function () { - return dataRemoteProjects; + service.getRemoteProducts = function () { + return dataRemoteProducts; }; - service.getByScopeId = function (remoteProjectManagerId, scopeId) { + service.getByScopeId = function (remoteProductManagerId, scopeId) { return $q(function (resolve, reject) { - for (var i in dataRemoteProjects[remoteProjectManagerId]) { - if (dataRemoteProjects[remoteProjectManagerId][i].id === scopeId) { - resolve(dataRemoteProjects[remoteProjectManagerId][i]); + for (var i in dataRemoteProducts[remoteProductManagerId]) { + if (dataRemoteProducts[remoteProductManagerId][i].id === scopeId) { + resolve(dataRemoteProducts[remoteProductManagerId][i]); } } reject(undefined); diff --git a/tests/mock/service/mockWsApi.js b/tests/mock/service/mockWsApi.js index 6c2ebe8..1abbf32 100644 --- a/tests/mock/service/mockWsApi.js +++ b/tests/mock/service/mockWsApi.js @@ -50,15 +50,15 @@ angular.module("mock.wsApi", []).service("WsApi", function ($q) { }; } - if (apiReq === apiMapping.ProjectsStats.all) { + if (apiReq === apiMapping.ProductsStats.all) { payload = { - "ArrayList": dataProjectsStats + "ArrayList": dataProductsStats }; } - if (apiReq === apiMapping.RemoteProjects.all) { + if (apiReq === apiMapping.RemoteProducts.all) { payload = { - "HashMap": dataRemoteProjects + "HashMap": dataRemoteProducts }; } } diff --git a/tests/unit/controllers/productControllerTest.js b/tests/unit/controllers/productControllerTest.js index 92d53c7..5119685 100644 --- a/tests/unit/controllers/productControllerTest.js +++ b/tests/unit/controllers/productControllerTest.js @@ -1,38 +1,38 @@ -describe("controller: ProjectController", function () { - var $compile, $q, $scope, $templateCache, $templateRequest, MockedProject, MockedRemoteProjectManager, MockedUser, WsApi, controller; +describe("controller: ProductController", function () { + var $compile, $q, $scope, $templateCache, $templateRequest, MockedProduct, MockedRemoteProductManager, MockedUser, WsApi, controller; var initializeVariables = function () { - inject(function (_$compile_, _$q_, _$templateCache_, _$templateRequest_, _ProjectRepo_, _WsApi_) { + inject(function (_$compile_, _$q_, _$templateCache_, _$templateRequest_, _ProductRepo_, _WsApi_) { $compile = _$compile_; $q = _$q_; $templateCache = _$templateCache_; $templateRequest = _$templateRequest_; MockedUser = new mockUser($q); - MockedProject = new mockProject($q); - MockedRemoteProjectManager = new mockRemoteProjectManager($q); + MockedProduct = new mockProduct($q); + MockedRemoteProductManager = new mockRemoteProductManager($q); - ProjectRepo = _ProjectRepo_; + ProductRepo = _ProductRepo_; WsApi = _WsApi_; }); }; var initializeController = function (settings) { - inject(function (_$controller_, _$rootScope_, _ModalService_, _Project_, _RemoteProjectManagerRepo_, _RemoteProjectsService_, _UserService_) { + inject(function (_$controller_, _$rootScope_, _ModalService_, _Product_, _RemoteProductManagerRepo_, _RemoteProductsService_, _UserService_) { $scope = _$rootScope_.$new(); sessionStorage.role = settings && settings.role ? settings.role : "ROLE_ADMIN"; sessionStorage.token = settings && settings.token ? settings.token : "faketoken"; - controller = _$controller_("ProjectController", { + controller = _$controller_("ProductController", { $scope: $scope, $compile: $compile, $templateRequest: $templateRequest, ModalService: _ModalService_, - Project: _Project_, - ProjectRepo: ProjectRepo, - RemoteProjectManagerRepo: _RemoteProjectManagerRepo_, - RemoteProjectsService: _RemoteProjectsService_, + Product: _Product_, + ProductRepo: ProductRepo, + RemoteProductManagerRepo: _RemoteProductManagerRepo_, + RemoteProductsService: _RemoteProductsService_, UserService: _UserService_ }); @@ -47,21 +47,21 @@ describe("controller: ProjectController", function () { module("core"); module("app"); module("templates"); - module("mock.project", function ($provide) { - var Project = function () { - return MockedProject; + module("mock.product", function ($provide) { + var Product = function () { + return MockedProduct; }; - $provide.value("Project", Project); + $provide.value("Product", Product); }); - module("mock.projectRepo"); - module("mock.remoteProjectManager", function ($provide) { - var RemoteProjectManager = function () { - return MockedRemoteProjectManager; + module("mock.productRepo"); + module("mock.remoteProductManager", function ($provide) { + var RemoteProductManager = function () { + return MockedRemoteProductManager; }; - $provide.value("RemoteProjectManager", RemoteProjectManager); + $provide.value("RemoteProductManager", RemoteProductManager); }); - module("mock.remoteProjectManagerRepo"); - module("mock.remoteProjectService"); + module("mock.remoteProductManagerRepo"); + module("mock.remoteProductService"); module("mock.user", function ($provide) { var User = function () { return MockedUser; @@ -93,15 +93,15 @@ describe("controller: ProjectController", function () { describe("Is the scope method", function () { var methods = [ - "resetProjectForms", - "createProject", - "resetCreateProject", - "editProject", - "updateProject", - "cancelEditProject", - "confirmDeleteProject", - "cancelDeleteProject", - "deleteProject" + "resetProductForms", + "createProduct", + "resetCreateProduct", + "editProduct", + "updateProduct", + "cancelEditProduct", + "confirmDeleteProduct", + "cancelDeleteProduct", + "deleteProduct" ]; var scopeMethodExists = function (method) { @@ -117,116 +117,116 @@ describe("controller: ProjectController", function () { }); describe("Does the scope method", function () { - it("resetProjectForms reset project forms", function () { - var modal = angular.element($templateCache.get("views/modals/addProjectModal.html")); + it("resetProductForms reset product forms", function () { + var modal = angular.element($templateCache.get("views/modals/addProductModal.html")); modal = $compile(modal)($scope); - var form = $scope.projectForms.create; + var form = $scope.productForms.create; form.$setDirty(); expect(form.$dirty).toEqual(true); - $scope.resetProjectForms(); + $scope.resetProductForms(); expect(form.$pristine).toEqual(true); expect(form.$dirty).toEqual(false); }); - it("createProject create a new project", function () { - var newProject = new mockProject($q); + it("createProduct create a new product", function () { + var newProduct = new mockProduct($q); - newProject.mock({ - id: dataProjectRepo1.length + 1, - name: "Mock Project 4" + newProduct.mock({ + id: dataProductRepo1.length + 1, + name: "Mock Product 4" }); - $scope.projectToCreate = newProject; - $scope.createProject(); + $scope.productToCreate = newProduct; + $scope.createProduct(); - expect(ProjectRepo.findById(newProject.id)).toEqual(newProject); + expect(ProductRepo.findById(newProduct.id)).toEqual(newProduct); }); - it("resetCreateProject call resetProjectForms() and clear out the name field", function () { - spyOn($scope, "resetProjectForms"); + it("resetCreateProduct call resetProductForms() and clear out the name field", function () { + spyOn($scope, "resetProductForms"); - $scope.projectToCreate = new mockProject($q); - $scope.projectToCreate.mock({ - id: dataProjectRepo1.length + 1, - name: "Mock Project 4" + $scope.productToCreate = new mockProduct($q); + $scope.productToCreate.mock({ + id: dataProductRepo1.length + 1, + name: "Mock Product 4" }); - var modal = angular.element($templateCache.get("views/modals/addProjectModal.html")); + var modal = angular.element($templateCache.get("views/modals/addProductModal.html")); modal = $compile(modal)($scope); - var form = $scope.projectForms.create; + var form = $scope.productForms.create; form.$setDirty(); - $scope.resetCreateProject(); + $scope.resetCreateProduct(); - expect($scope.projectToCreate.name).toEqual(""); - expect($scope.resetProjectForms).toHaveBeenCalled(); + expect($scope.productToCreate.name).toEqual(""); + expect($scope.resetProductForms).toHaveBeenCalled(); }); - it("editProject set the projectToEdit and open the modal", function () { + it("editProduct set the productToEdit and open the modal", function () { spyOn($scope, "openModal"); - $scope.editProject(dataProjectRepo1[0]); + $scope.editProduct(dataProductRepo1[0]); - expect($scope.projectToEdit).toEqual(dataProjectRepo1[0]); + expect($scope.productToEdit).toEqual(dataProductRepo1[0]); expect($scope.openModal).toHaveBeenCalled(); }); - it("updateProject call dirty and save on the Project, and then call cancelEditProject", function () { - var project = new mockProject($q); + it("updateProduct call dirty and save on the Product, and then call cancelEditProduct", function () { + var product = new mockProduct($q); - spyOn($scope, "cancelEditProject"); - spyOn(project, "dirty"); + spyOn($scope, "cancelEditProduct"); + spyOn(product, "dirty"); deferred = $q.defer(); - spyOn(project, "save").and.returnValue(deferred.promise); - $scope.projectToEdit = project; - $scope.updateProject(); + spyOn(product, "save").and.returnValue(deferred.promise); + $scope.productToEdit = product; + $scope.updateProduct(); deferred.resolve(); $scope.$apply(); - expect($scope.cancelEditProject).toHaveBeenCalled(); - expect(project.dirty).toHaveBeenCalledWith(true); - expect(project.save).toHaveBeenCalled(); + expect($scope.cancelEditProduct).toHaveBeenCalled(); + expect(product.dirty).toHaveBeenCalledWith(true); + expect(product.save).toHaveBeenCalled(); }); - it("cancelEditProject clear out projectToEdit and call resetProjectForms", function () { - var project = new mockProject($q); + it("cancelEditProduct clear out productToEdit and call resetProductForms", function () { + var product = new mockProduct($q); - spyOn($scope, "resetProjectForms"); - $scope.projectToEdit = project; - $scope.cancelEditProject(); + spyOn($scope, "resetProductForms"); + $scope.productToEdit = product; + $scope.cancelEditProduct(); - expect($scope.projectToEdit).toEqual({}); - expect($scope.resetProjectForms).toHaveBeenCalled(); + expect($scope.productToEdit).toEqual({}); + expect($scope.resetProductForms).toHaveBeenCalled(); }); - it("confirmDeleteProject set the projectToDelete and open the modal", function () { + it("confirmDeleteProduct set the productToDelete and open the modal", function () { spyOn($scope, "openModal"); - $scope.confirmDeleteProject(dataProjectRepo1[0]); + $scope.confirmDeleteProduct(dataProductRepo1[0]); expect($scope.openModal).toHaveBeenCalled(); - expect($scope.projectToDelete).toEqual(dataProjectRepo1[0]); + expect($scope.productToDelete).toEqual(dataProductRepo1[0]); }); - it("cancelDeleteProject clear projectToDelete and close the modal", function () { + it("cancelDeleteProduct clear productToDelete and close the modal", function () { spyOn($scope, "closeModal"); - $scope.projectToDelete = dataProjectRepo1[0]; - $scope.cancelDeleteProject(); + $scope.productToDelete = dataProductRepo1[0]; + $scope.cancelDeleteProduct(); expect($scope.closeModal).toHaveBeenCalled(); - expect($scope.projectToDelete).toEqual({}); + expect($scope.productToDelete).toEqual({}); }); - it("deleteProject call the repo delete method and then call cancelDeleteProject when successful", function () { - var project = new mockProject($q); + it("deleteProduct call the repo delete method and then call cancelDeleteProduct when successful", function () { + var product = new mockProduct($q); - $scope.projectToDelete = project; + $scope.productToDelete = product; deferred = $q.defer(); - spyOn(ProjectRepo, "delete").and.returnValue(deferred.promise); - spyOn($scope, "cancelDeleteProject"); - $scope.deleteProject(project); + spyOn(ProductRepo, "delete").and.returnValue(deferred.promise); + spyOn($scope, "cancelDeleteProduct"); + $scope.deleteProduct(product); deferred.resolve({ body: angular.toJson({ meta: { @@ -236,8 +236,8 @@ describe("controller: ProjectController", function () { }); $scope.$apply(); - expect(ProjectRepo.delete).toHaveBeenCalledWith(project); - expect($scope.cancelDeleteProject).toHaveBeenCalled(); + expect(ProductRepo.delete).toHaveBeenCalledWith(product); + expect($scope.cancelDeleteProduct).toHaveBeenCalled(); }); }); diff --git a/tests/unit/controllers/remoteProductManagerControllerTest.js b/tests/unit/controllers/remoteProductManagerControllerTest.js index 633b719..540a235 100644 --- a/tests/unit/controllers/remoteProductManagerControllerTest.js +++ b/tests/unit/controllers/remoteProductManagerControllerTest.js @@ -1,32 +1,32 @@ -describe("controller: RemoteProjectManagerController", function () { - var $compile, $q, $scope, $templateCache, MockedRemoteProjectManager, RemoteProjectManagerRepo, WsApi, controller; +describe("controller: RemoteProductManagerController", function () { + var $compile, $q, $scope, $templateCache, MockedRemoteProductManager, RemoteProductManagerRepo, WsApi, controller; var initializeVariables = function () { - inject(function (_$compile_, _$q_, _$templateCache_, _RemoteProjectManagerRepo_, _WsApi_) { + inject(function (_$compile_, _$q_, _$templateCache_, _RemoteProductManagerRepo_, _WsApi_) { $compile = _$compile_; $q = _$q_; $templateCache = _$templateCache_; - MockedRemoteProjectManager = new mockRemoteProjectManager($q); + MockedRemoteProductManager = new mockRemoteProductManager($q); - RemoteProjectManagerRepo = _RemoteProjectManagerRepo_; + RemoteProductManagerRepo = _RemoteProductManagerRepo_; WsApi = _WsApi_; }); }; var initializeController = function (settings) { - inject(function (_$controller_, _$filter_, _$rootScope_, _ModalService_, _RemoteProjectManager_) { + inject(function (_$controller_, _$filter_, _$rootScope_, _ModalService_, _RemoteProductManager_) { $scope = _$rootScope_.$new(); sessionStorage.role = settings && settings.role ? settings.role : "ROLE_ADMIN"; sessionStorage.token = settings && settings.token ? settings.token : "faketoken"; - controller = _$controller_("RemoteProjectManagerController", { + controller = _$controller_("RemoteProductManagerController", { $scope: $scope, $compile: $compile, $filter: _$filter_, ModalService: _ModalService_, - RemoteProjectManagerRepo: RemoteProjectManagerRepo + RemoteProductManagerRepo: RemoteProductManagerRepo }); // ensure that the isReady() is called. @@ -40,13 +40,13 @@ describe("controller: RemoteProjectManagerController", function () { module("core"); module("app"); module("templates"); - module("mock.remoteProjectManager", function ($provide) { - var RemoteProjectManager = function () { - return MockedRemoteProjectManager; + module("mock.remoteProductManager", function ($provide) { + var RemoteProductManager = function () { + return MockedRemoteProductManager; }; - $provide.value("RemoteProjectManager", RemoteProjectManager); + $provide.value("RemoteProductManager", RemoteProductManager); }); - module("mock.remoteProjectManagerRepo"); + module("mock.remoteProductManagerRepo"); module("mock.wsApi"); installPromiseMatchers(); @@ -71,15 +71,15 @@ describe("controller: RemoteProjectManagerController", function () { describe("Is the scope method", function () { var methods = [ - "resetRemoteProjectManagerForms", - "createRemoteProjectManager", - "resetCreateRemoteProjectManager", - "editRemoteProjectManager", - "updateRemoteProjectManager", - "cancelEditRemoteProjectManager", - "confirmDeleteRemoteProjectManager", - "cancelDeleteRemoteProjectManager", - "deleteRemoteProjectManager", + "resetRemoteProductManagerForms", + "createRemoteProductManager", + "resetCreateRemoteProductManager", + "editRemoteProductManager", + "updateRemoteProductManager", + "cancelEditRemoteProductManager", + "confirmDeleteRemoteProductManager", + "cancelDeleteRemoteProductManager", + "deleteRemoteProductManager", "typeSettings" ]; @@ -96,24 +96,24 @@ describe("controller: RemoteProjectManagerController", function () { }); describe("Does the scope method", function () { - it("resetRemoteProjectManagerForms reset Remote Project Manager forms", function () { + it("resetRemoteProductManagerForms reset Remote Product Manager forms", function () { - var modal = angular.element($templateCache.get("views/modals/addRemoteProjectManagerModal.html")); + var modal = angular.element($templateCache.get("views/modals/addRemoteProductManagerModal.html")); modal = $compile(modal)($scope); - var form = $scope.remoteProjectManagerForms.create; + var form = $scope.remoteProductManagerForms.create; form.$setDirty(); expect(form.$dirty).toEqual(true); - $scope.resetRemoteProjectManagerForms(); + $scope.resetRemoteProductManagerForms(); expect(form.$pristine).toEqual(true); expect(form.$dirty).toEqual(false); }); - it("createRemoteProjectManager create a new Remote Project Manager", function () { - var newRemoteProjectManager = { + it("createRemoteProductManager create a new Remote Product Manager", function () { + var newRemoteProductManager = { "id": 4, "name": "Test 4", "type": "VERSION_ONE", @@ -123,14 +123,14 @@ describe("controller: RemoteProjectManagerController", function () { "username": "username4" } }; - $scope.remoteProjectManagerToCreate = newRemoteProjectManager; - $scope.createRemoteProjectManager(); + $scope.remoteProductManagerToCreate = newRemoteProductManager; + $scope.createRemoteProductManager(); - expect(RemoteProjectManagerRepo.findById(newRemoteProjectManager.id)).toEqual(newRemoteProjectManager); + expect(RemoteProductManagerRepo.findById(newRemoteProductManager.id)).toEqual(newRemoteProductManager); }); - it("resetCreateRemoteProjectManager call resetRemoteProjectManagerForms() and clear out the fields", function () { - var newRemoteProjectManager = { + it("resetCreateRemoteProductManager call resetRemoteProductManagerForms() and clear out the fields", function () { + var newRemoteProductManager = { "id": 4, "name": "Test 4", "type": "VERSION_ONE", @@ -150,35 +150,35 @@ describe("controller: RemoteProjectManagerController", function () { "username": "username4" } }; - spyOn($scope, "resetRemoteProjectManagerForms"); - spyOn(RemoteProjectManagerRepo, "getScaffold").and.returnValue(scaffold); + spyOn($scope, "resetRemoteProductManagerForms"); + spyOn(RemoteProductManagerRepo, "getScaffold").and.returnValue(scaffold); - $scope.remoteProjectManagerToCreate = newRemoteProjectManager; - $scope.resetCreateRemoteProjectManager(); + $scope.remoteProductManagerToCreate = newRemoteProductManager; + $scope.resetCreateRemoteProductManager(); - expect($scope.remoteProjectManagerToCreate.name).toEqual(""); - expect($scope.resetRemoteProjectManagerForms).toHaveBeenCalled(); + expect($scope.remoteProductManagerToCreate.name).toEqual(""); + expect($scope.resetRemoteProductManagerForms).toHaveBeenCalled(); }); - it("editRemoteProjectManager set the remoteProjectManagerToEdit and open the modal", function () { - var remoteProjectManager = new mockRemoteProjectManager($q); + it("editRemoteProductManager set the remoteProductManagerToEdit and open the modal", function () { + var remoteProductManager = new mockRemoteProductManager($q); spyOn($scope, "openModal"); - $scope.editRemoteProjectManager(remoteProjectManager); + $scope.editRemoteProductManager(remoteProductManager); - expect($scope.remoteProjectManagerToEdit).toEqual(remoteProjectManager); + expect($scope.remoteProductManagerToEdit).toEqual(remoteProductManager); expect($scope.openModal).toHaveBeenCalled(); }); - it("updateRemoteProjectManager call dirty and save on the Remote Project Manager, and then call cancelEditRemoteProjectManager", function () { - var remoteProjectManager = new mockRemoteProjectManager($q); + it("updateRemoteProductManager call dirty and save on the Remote Product Manager, and then call cancelEditRemoteProductManager", function () { + var remoteProductManager = new mockRemoteProductManager($q); - spyOn($scope, "cancelEditRemoteProjectManager"); - spyOn(remoteProjectManager, "dirty"); + spyOn($scope, "cancelEditRemoteProductManager"); + spyOn(remoteProductManager, "dirty"); deferred = $q.defer(); - spyOn(remoteProjectManager, "save").and.returnValue(deferred.promise); - $scope.remoteProjectManagerToEdit = remoteProjectManager; - $scope.updateRemoteProjectManager(); + spyOn(remoteProductManager, "save").and.returnValue(deferred.promise); + $scope.remoteProductManagerToEdit = remoteProductManager; + $scope.updateRemoteProductManager(); deferred.resolve({ body: angular.toJson({ meta: { @@ -188,53 +188,53 @@ describe("controller: RemoteProjectManagerController", function () { }); $scope.$apply(); - expect($scope.cancelEditRemoteProjectManager).toHaveBeenCalled(); - expect(remoteProjectManager.dirty).toHaveBeenCalledWith(true); - expect(remoteProjectManager.save).toHaveBeenCalled(); + expect($scope.cancelEditRemoteProductManager).toHaveBeenCalled(); + expect(remoteProductManager.dirty).toHaveBeenCalledWith(true); + expect(remoteProductManager.save).toHaveBeenCalled(); }); - it("cancelEditRemoteProjectManager clear out remoteProjectManagerToEdit and call resetRemoteProjectManagerForms", function () { - var remoteProjectManager = new mockRemoteProjectManager($q); + it("cancelEditRemoteProductManager clear out remoteProductManagerToEdit and call resetRemoteProductManagerForms", function () { + var remoteProductManager = new mockRemoteProductManager($q); - spyOn(remoteProjectManager, "refresh"); - spyOn($scope, "resetRemoteProjectManagerForms"); + spyOn(remoteProductManager, "refresh"); + spyOn($scope, "resetRemoteProductManagerForms"); - $scope.remoteProjectManagerToEdit = remoteProjectManager; - $scope.cancelEditRemoteProjectManager(); + $scope.remoteProductManagerToEdit = remoteProductManager; + $scope.cancelEditRemoteProductManager(); - expect(remoteProjectManager.refresh).toHaveBeenCalled(); - expect($scope.resetRemoteProjectManagerForms).toHaveBeenCalled(); + expect(remoteProductManager.refresh).toHaveBeenCalled(); + expect($scope.resetRemoteProductManagerForms).toHaveBeenCalled(); }); - it("confirmDeleteRemoteProjectManager set the remoteProjectManagerToDelete and open the modal", function () { - var remoteProjectManager = new mockRemoteProjectManager($q); + it("confirmDeleteRemoteProductManager set the remoteProductManagerToDelete and open the modal", function () { + var remoteProductManager = new mockRemoteProductManager($q); spyOn($scope, "openModal"); - $scope.confirmDeleteRemoteProjectManager(remoteProjectManager); + $scope.confirmDeleteRemoteProductManager(remoteProductManager); expect($scope.openModal).toHaveBeenCalled(); - expect($scope.remoteProjectManagerToDelete).toEqual(remoteProjectManager); + expect($scope.remoteProductManagerToDelete).toEqual(remoteProductManager); }); - it("cancelDeleteRemoteProjectManager clear remoteProjectManagerToDelete and close the modal", function () { - var remoteProjectManager = new mockRemoteProjectManager($q); + it("cancelDeleteRemoteProductManager clear remoteProductManagerToDelete and close the modal", function () { + var remoteProductManager = new mockRemoteProductManager($q); spyOn($scope, "closeModal"); - $scope.remoteProjectManagerToDelete = remoteProjectManager; - $scope.cancelDeleteRemoteProjectManager(); + $scope.remoteProductManagerToDelete = remoteProductManager; + $scope.cancelDeleteRemoteProductManager(); expect($scope.closeModal).toHaveBeenCalled(); - expect($scope.remoteProjectManagerToDelete).toEqual({}); + expect($scope.remoteProductManagerToDelete).toEqual({}); }); - it("deleteRemoteProjectManager call the repo delete method and then call cancelDeleteRemoteProjectManager when successful", function () { - var remoteProjectManager = new mockRemoteProjectManager($q); + it("deleteRemoteProductManager call the repo delete method and then call cancelDeleteRemoteProductManager when successful", function () { + var remoteProductManager = new mockRemoteProductManager($q); - $scope.remoteProjectManagerToDelete = remoteProjectManager; + $scope.remoteProductManagerToDelete = remoteProductManager; deferred = $q.defer(); - spyOn(RemoteProjectManagerRepo, "delete").and.returnValue(deferred.promise); - spyOn($scope, "cancelDeleteRemoteProjectManager"); - $scope.deleteRemoteProjectManager(remoteProjectManager); + spyOn(RemoteProductManagerRepo, "delete").and.returnValue(deferred.promise); + spyOn($scope, "cancelDeleteRemoteProductManager"); + $scope.deleteRemoteProductManager(remoteProductManager); deferred.resolve({ body: angular.toJson({ meta: { @@ -244,8 +244,8 @@ describe("controller: RemoteProjectManagerController", function () { }); $scope.$apply(); - expect(RemoteProjectManagerRepo.delete).toHaveBeenCalledWith(remoteProjectManager); - expect($scope.cancelDeleteRemoteProjectManager).toHaveBeenCalled(); + expect(RemoteProductManagerRepo.delete).toHaveBeenCalledWith(remoteProductManager); + expect($scope.cancelDeleteRemoteProductManager).toHaveBeenCalled(); }); it("typeSettings return appropriate scaffold", function () { diff --git a/tests/unit/directives/remoteProductManagerFormDirectiveTest.js b/tests/unit/directives/remoteProductManagerFormDirectiveTest.js index 05444bf..3721a16 100644 --- a/tests/unit/directives/remoteProductManagerFormDirectiveTest.js +++ b/tests/unit/directives/remoteProductManagerFormDirectiveTest.js @@ -1,4 +1,4 @@ -describe("directive: remoteProjectManagerForm", function () { +describe("directive: remoteProductManagerForm", function () { var $compile, $q, $scope, directive, element, formSettings, formModel; var initializeVariables = function () { @@ -39,10 +39,10 @@ describe("directive: remoteProjectManagerForm", function () { inject(function (_$rootScope_) { $scope = _$rootScope_.$new(); - var attr = settings && settings.attr ? settings.attr : "management-settings='settings' model='model'>" + body + ""); + element = angular.element("" + body + ""); directive = $compile(element)($scope); $scope.model = formModel; diff --git a/tests/unit/model/productTest.js b/tests/unit/model/productTest.js index 5e97d37..b109b9d 100644 --- a/tests/unit/model/productTest.js +++ b/tests/unit/model/productTest.js @@ -1,4 +1,4 @@ -describe("model: Project", function () { +describe("model: Product", function () { var $rootScope, $scope, WsApi, model; var initializeVariables = function (settings) { @@ -10,10 +10,10 @@ describe("model: Project", function () { }; var initializeModel = function (settings) { - inject(function (_Project_) { + inject(function (_Product_) { $scope = $rootScope.$new(); - model = angular.extend(new _Project_(), dataProject1); + model = angular.extend(new _Product_(), dataProduct1); }); }; diff --git a/tests/unit/model/remoteProductManagerTest.js b/tests/unit/model/remoteProductManagerTest.js index c8fde5e..f995092 100644 --- a/tests/unit/model/remoteProductManagerTest.js +++ b/tests/unit/model/remoteProductManagerTest.js @@ -1,4 +1,4 @@ -describe("model: RemoteProjectManager", function () { +describe("model: RemoteProductManager", function () { var $rootScope, $scope, WsApi, model; var initializeVariables = function (settings) { @@ -10,10 +10,10 @@ describe("model: RemoteProjectManager", function () { }; var initializeModel = function (settings) { - inject(function (_RemoteProjectManager_) { + inject(function (_RemoteProductManager_) { $scope = $rootScope.$new(); - model = angular.extend(new _RemoteProjectManager_(), dataRemoteProjectManager1); + model = angular.extend(new _RemoteProductManager_(), dataRemoteProductManager1); }); }; diff --git a/tests/unit/repo/productRepoTest.js b/tests/unit/repo/productRepoTest.js index 208e0a9..41098e8 100644 --- a/tests/unit/repo/productRepoTest.js +++ b/tests/unit/repo/productRepoTest.js @@ -1,4 +1,4 @@ -describe("service: ProjectRepo", function () { +describe("service: ProductRepo", function () { var $q, $rootScope, $scope, WsApi, repo; var initializeVariables = function (settings) { @@ -11,10 +11,10 @@ describe("service: ProjectRepo", function () { }; var initializeRepo = function (settings) { - inject(function ($injector, _ProjectRepo_) { + inject(function ($injector, _ProductRepo_) { $scope = $rootScope.$new(); - repo = _ProjectRepo_; + repo = _ProductRepo_; }); }; diff --git a/tests/unit/repo/remoteProductManagerRepoTest.js b/tests/unit/repo/remoteProductManagerRepoTest.js index 17caba0..9ea6261 100644 --- a/tests/unit/repo/remoteProductManagerRepoTest.js +++ b/tests/unit/repo/remoteProductManagerRepoTest.js @@ -1,4 +1,4 @@ -describe("service: RemoteProjectManagerRepo", function () { +describe("service: RemoteProductManagerRepo", function () { var $q, $rootScope, $scope, MockedUser, WsApi, repo; var initializeVariables = function (settings) { @@ -12,10 +12,10 @@ describe("service: RemoteProjectManagerRepo", function () { }; var initializeRepo = function (settings) { - inject(function ($injector, _RemoteProjectManagerRepo_) { + inject(function ($injector, _RemoteProductManagerRepo_) { $scope = $rootScope.$new(); - repo = _RemoteProjectManagerRepo_; + repo = _RemoteProductManagerRepo_; }); }; diff --git a/tests/unit/services/productsStatsServiceTest.js b/tests/unit/services/productsStatsServiceTest.js index b0595ab..2d5cb1a 100644 --- a/tests/unit/services/productsStatsServiceTest.js +++ b/tests/unit/services/productsStatsServiceTest.js @@ -1,21 +1,21 @@ -describe("service: ProjectsStatsService", function () { - var $q, $rootScope, $scope, ProjectRepo, WsApi, service; +describe("service: ProductsStatsService", function () { + var $q, $rootScope, $scope, ProductRepo, WsApi, service; var initializeVariables = function (settings) { - inject(function (_$q_, _$rootScope_, _ProjectRepo_, _WsApi_) { + inject(function (_$q_, _$rootScope_, _ProductRepo_, _WsApi_) { $q = _$q_; $rootScope = _$rootScope_; - ProjectRepo = _ProjectRepo_; + ProductRepo = _ProductRepo_; WsApi = _WsApi_; }); }; var initializeService = function (settings) { - inject(function ($injector, _ProjectsStatsService_) { + inject(function ($injector, _ProductsStatsService_) { $scope = $rootScope.$new(); - service = _ProjectsStatsService_; + service = _ProductsStatsService_; // ensure that the isReady() is called. if (!$scope.$$phase) { @@ -27,7 +27,7 @@ describe("service: ProjectsStatsService", function () { beforeEach(function () { module("core"); module("app"); - module("mock.projectRepo"); + module("mock.productRepo"); module("mock.wsApi"); initializeVariables(); @@ -43,8 +43,8 @@ describe("service: ProjectsStatsService", function () { describe("Is the service method", function () { var methods = [ "getById", - "getProjectsStats", - "refreshProjectsStats" + "getProductsStats", + "refreshProductsStats" ]; var serviceMethodExists = function (method) { @@ -77,24 +77,24 @@ describe("service: ProjectsStatsService", function () { }); describe("Do the service method", function () { - it("getById get project stats by id", function () { + it("getById get product stats by id", function () { $rootScope.$apply(); - service.getById(1).then(function (projectStats) { - expect(projectStats).toEqual(dataProjectsStats[0]); + service.getById(1).then(function (productStats) { + expect(productStats).toEqual(dataProductsStats[0]); }); }); - it("getProjectsStats get project stats", function () { - var projectsStats = service.getProjectsStats(); - expect(projectsStats).toEqual(dataProjectsStats); + it("getProductsStats get product stats", function () { + var productsStats = service.getProductsStats(); + expect(productsStats).toEqual(dataProductsStats); }); - it("refreshProjectsStats fetch project stats", function () { + it("refreshProductsStats fetch product stats", function () { deferred = $q.defer(); spyOn(WsApi, "fetch").and.returnValue(deferred.promise); - service.refreshProjectsStats(); - deferred.resolve(dataProjectsStats); - expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.ProjectsStats.all); + service.refreshProductsStats(); + deferred.resolve(dataProductsStats); + expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.ProductsStats.all); }); }); diff --git a/tests/unit/services/remoteProductServiceTest.js b/tests/unit/services/remoteProductServiceTest.js index a0bc0cc..08cefaf 100644 --- a/tests/unit/services/remoteProductServiceTest.js +++ b/tests/unit/services/remoteProductServiceTest.js @@ -1,21 +1,21 @@ -describe("service: RemoteProjectsService", function () { - var $q, $rootScope, $scope, ProjectRepo, WsApi, service; +describe("service: RemoteProductsService", function () { + var $q, $rootScope, $scope, ProductRepo, WsApi, service; var initializeVariables = function (settings) { - inject(function (_$q_, _$rootScope_, _ProjectRepo_, _WsApi_) { + inject(function (_$q_, _$rootScope_, _ProductRepo_, _WsApi_) { $q = _$q_; $rootScope = _$rootScope_; - ProjectRepo = _ProjectRepo_; + ProductRepo = _ProductRepo_; WsApi = _WsApi_; }); }; var initializeService = function (settings) { - inject(function ($injector, _RemoteProjectsService_) { + inject(function ($injector, _RemoteProductsService_) { $scope = $rootScope.$new(); - service = _RemoteProjectsService_; + service = _RemoteProductsService_; // ensure that the isReady() is called. if (!$scope.$$phase) { @@ -27,7 +27,7 @@ describe("service: RemoteProjectsService", function () { beforeEach(function () { module("core"); module("app"); - module("mock.projectRepo"); + module("mock.productRepo"); module("mock.wsApi"); initializeVariables(); @@ -43,8 +43,8 @@ describe("service: RemoteProjectsService", function () { describe("Is the service method", function () { var methods = [ "getByScopeId", - "getRemoteProjects", - "refreshRemoteProjects" + "getRemoteProducts", + "refreshRemoteProducts" ]; var serviceMethodExists = function (method) { @@ -77,24 +77,24 @@ describe("service: RemoteProjectsService", function () { }); describe("Does the service method", function () { - it("getByScopeId get remote project by remote project manager id and scope id", function () { + it("getByScopeId get remote product by remote product manager id and scope id", function () { $rootScope.$apply(); - service.getByScopeId(1, 1934).then(function (remoteProject) { - expect(remoteProject).toEqual(dataRemoteProjects["1"][0]); + service.getByScopeId(1, 1934).then(function (remoteProduct) { + expect(remoteProduct).toEqual(dataRemoteProducts["1"][0]); }); }); - it("getRemoteProjects get remote projects", function () { - var remoteProjects = service.getRemoteProjects(); - expect(remoteProjects).toEqual(dataRemoteProjects); + it("getRemoteProducts get remote products", function () { + var remoteProducts = service.getRemoteProducts(); + expect(remoteProducts).toEqual(dataRemoteProducts); }); - it("refreshRemoteProjects fetch remote projects", function () { + it("refreshRemoteProducts fetch remote products", function () { deferred = $q.defer(); spyOn(WsApi, "fetch").and.returnValue(deferred.promise); - service.refreshRemoteProjects(); - deferred.resolve(dataRemoteProjects); - expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.RemoteProjects.all); + service.refreshRemoteProducts(); + deferred.resolve(dataRemoteProducts); + expect(WsApi.fetch).toHaveBeenCalledWith(apiMapping.RemoteProducts.all); }); });