From c7384bb3ac5e97098b225046939cb6347fb552e9 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 25 Oct 2019 00:53:53 +0200 Subject: [PATCH] API path prefix, repeated code removed from tests --- .../components/autocomplete/index.spec.js | 4 +- .../core/components/button-menu/index.spec.js | 4 +- front/core/components/calendar/index.spec.js | 4 +- front/core/components/check/index.spec.js | 4 +- front/core/components/chip/index.spec.js | 4 +- .../core/components/date-picker/index.spec.js | 4 +- front/core/components/dialog/dialog.spec.js | 4 +- .../components/drop-down/drop-down.spec.js | 4 +- .../core/components/input-file/index.spec.js | 4 +- .../components/input-number/index.spec.js | 4 +- .../core/components/input-time/index.spec.js | 4 +- .../label-value/label-value.spec.js | 4 +- .../multi-check/multi-check.spec.js | 4 +- front/core/components/popover/popover.spec.js | 4 +- front/core/components/radio/index.spec.js | 4 +- .../components/searchbar/searchbar.spec.js | 4 +- front/core/components/spinner/spinner.spec.js | 4 +- .../step-control/step-control.spec.js | 4 +- front/core/components/table/index.spec.js | 4 +- front/core/components/textarea/index.spec.js | 4 +- front/core/components/th/index.spec.js | 4 +- front/core/components/tooltip/tooltip.spec.js | 4 +- front/core/components/treeview/index.spec.js | 4 +- front/core/components/watcher/watcher.spec.js | 4 +- front/core/directives/specs/acl.spec.js | 6 +- front/core/directives/specs/bind.spec.js | 4 +- front/core/directives/specs/dialog.spec.js | 4 +- front/core/directives/specs/focus.spec.js | 4 +- front/core/directives/specs/id.spec.js | 4 +- front/core/directives/specs/rule.spec.js | 4 +- .../core/directives/specs/zoom-image.spec.js | 4 +- front/core/directives/uvc.js | 4 +- front/core/filters/specs/currency.spec.js | 4 +- front/core/lib/specs/acl-service.spec.js | 6 +- front/core/lib/specs/module-loader.spec.js | 4 +- front/core/lib/specs/validator.spec.js | 4 +- front/core/module.js | 8 +- front/core/services/acl-service.js | 2 +- front/core/services/auth.js | 4 +- front/core/services/config.js | 4 +- front/core/services/interceptor.js | 15 ++- .../components/left-menu/left-menu.spec.js | 4 +- front/salix/components/main-menu/main-menu.js | 2 +- .../components/main-menu/main-menu.spec.js | 8 +- .../salix/components/user-popover/index.html | 6 +- .../components/user-popover/index.spec.js | 6 +- jest-front.js | 22 +++- modules/agency/front/basic-data/index.html | 4 +- modules/agency/front/card/index.js | 2 +- modules/agency/front/card/index.spec.js | 6 +- modules/agency/front/create/index.html | 6 +- modules/agency/front/create/index.spec.js | 4 +- modules/agency/front/delivery-days/index.html | 4 +- modules/agency/front/delivery-days/index.js | 2 +- modules/agency/front/descriptor/index.js | 2 +- modules/agency/front/edit/index.html | 6 +- modules/agency/front/events/index.js | 4 +- modules/agency/front/index/index.html | 2 +- modules/agency/front/index/index.js | 2 +- modules/agency/front/index/index.spec.js | 4 +- .../front/location-search-panel/index.html | 4 +- modules/agency/front/location/index.html | 2 +- modules/agency/front/location/index.js | 2 +- modules/agency/front/search-panel/index.html | 2 +- modules/agency/front/summary/index.js | 2 +- modules/agency/front/warehouses/index.html | 2 +- modules/agency/front/warehouses/index.js | 2 +- modules/claim/front/action/index.html | 6 +- modules/claim/front/action/index.js | 18 +-- modules/claim/front/action/index.spec.js | 18 ++- modules/claim/front/basic-data/index.html | 6 +- modules/claim/front/basic-data/index.spec.js | 4 +- modules/claim/front/card/index.js | 2 +- modules/claim/front/card/index.spec.js | 6 +- modules/claim/front/descriptor/index.js | 6 +- modules/claim/front/descriptor/index.spec.js | 14 +-- modules/claim/front/detail/index.html | 2 +- modules/claim/front/detail/index.js | 12 +- modules/claim/front/detail/index.spec.js | 16 ++- modules/claim/front/development/index.html | 12 +- modules/claim/front/development/index.spec.js | 4 +- modules/claim/front/dms/index/index.html | 4 +- modules/claim/front/dms/index/index.js | 6 +- modules/claim/front/dms/index/index.spec.js | 16 ++- modules/claim/front/index/index.html | 2 +- modules/claim/front/search-panel/index.html | 6 +- modules/claim/front/summary/index.html | 4 +- modules/claim/front/summary/index.js | 2 +- modules/claim/front/summary/index.spec.js | 8 +- .../client/front/address/create/index.html | 12 +- .../client/front/address/create/index.spec.js | 4 +- modules/client/front/address/edit/index.html | 16 +-- .../client/front/address/edit/index.spec.js | 4 +- modules/client/front/address/index/index.html | 2 +- modules/client/front/address/index/index.js | 2 +- .../client/front/address/index/index.spec.js | 8 +- .../client/front/balance/create/index.html | 6 +- modules/client/front/balance/create/index.js | 4 +- modules/client/front/balance/index/index.html | 8 +- modules/client/front/balance/index/index.js | 2 +- .../client/front/balance/index/index.spec.js | 8 +- modules/client/front/basic-data/index.html | 6 +- modules/client/front/billing-data/index.html | 8 +- modules/client/front/billing-data/index.js | 4 +- .../client/front/billing-data/index.spec.js | 16 ++- modules/client/front/card/index.js | 2 +- modules/client/front/card/index.spec.js | 4 +- modules/client/front/contact/index.html | 2 +- modules/client/front/create/index.html | 12 +- modules/client/front/create/index.spec.js | 4 +- .../front/credit-insurance/create/index.js | 2 +- .../credit-insurance/create/index.spec.js | 8 +- .../front/credit-insurance/index/index.js | 4 +- .../credit-insurance/index/index.spec.js | 10 +- .../insurance/create/index.html | 2 +- .../insurance/index/index.html | 2 +- .../credit-insurance/insurance/index/index.js | 2 +- .../insurance/index/index.spec.js | 6 +- modules/client/front/credit/create/index.html | 2 +- modules/client/front/credit/create/index.js | 2 +- .../client/front/credit/create/index.spec.js | 16 ++- modules/client/front/credit/index/index.html | 2 +- .../client/front/descriptor-popover/index.js | 2 +- .../front/descriptor-popover/index.spec.js | 8 +- modules/client/front/dms/create/index.html | 8 +- modules/client/front/dms/create/index.js | 6 +- modules/client/front/dms/create/index.spec.js | 12 +- modules/client/front/dms/edit/index.html | 6 +- modules/client/front/dms/edit/index.js | 6 +- modules/client/front/dms/edit/index.spec.js | 12 +- modules/client/front/dms/index/index.html | 6 +- modules/client/front/dms/index/index.js | 2 +- modules/client/front/dms/index/index.spec.js | 8 +- modules/client/front/fiscal-data/index.html | 10 +- modules/client/front/fiscal-data/index.js | 2 +- .../client/front/fiscal-data/index.spec.js | 8 +- modules/client/front/greuge/create/index.html | 4 +- .../client/front/greuge/create/index.spec.js | 4 +- modules/client/front/greuge/index/index.html | 4 +- modules/client/front/index/index.html | 2 +- modules/client/front/index/index.spec.js | 4 +- modules/client/front/log/index.html | 2 +- modules/client/front/mandate/index.html | 2 +- modules/client/front/note/create/index.html | 2 +- .../client/front/note/create/index.spec.js | 4 +- modules/client/front/note/index/index.html | 2 +- modules/client/front/postcode/index.html | 6 +- modules/client/front/postcode/index.js | 2 +- modules/client/front/postcode/index.spec.js | 8 +- .../client/front/recovery/create/index.html | 2 +- .../front/recovery/create/index.spec.js | 4 +- .../client/front/recovery/index/index.html | 2 +- modules/client/front/recovery/index/index.js | 2 +- modules/client/front/sample/create/index.html | 6 +- modules/client/front/sample/create/index.js | 4 +- .../client/front/sample/create/index.spec.js | 20 ++- modules/client/front/sample/index/index.html | 2 +- modules/client/front/search-panel/index.html | 2 +- modules/client/front/sms/index.js | 2 +- modules/client/front/sms/index.spec.js | 8 +- modules/client/front/summary/index.js | 2 +- modules/client/front/summary/index.spec.js | 8 +- modules/client/front/web-access/index.html | 2 +- modules/client/front/web-access/index.js | 6 +- modules/client/front/web-access/index.spec.js | 16 ++- modules/client/front/web-payment/index.html | 2 +- modules/client/front/web-payment/index.js | 2 +- .../client/front/web-payment/index.spec.js | 6 +- modules/invoiceOut/front/card/index.js | 2 +- .../front/descriptor-popover/index.js | 2 +- modules/invoiceOut/front/descriptor/index.js | 6 +- modules/invoiceOut/front/index/index.html | 2 +- modules/invoiceOut/front/index/index.js | 2 +- modules/invoiceOut/front/summary/index.js | 2 +- .../invoiceOut/front/summary/index.spec.js | 8 +- modules/item/front/barcode/index.html | 2 +- modules/item/front/basic-data/index.html | 10 +- modules/item/front/basic-data/index.spec.js | 4 +- modules/item/front/botanical/index.html | 6 +- modules/item/front/botanical/index.js | 2 +- modules/item/front/botanical/index.spec.js | 8 +- modules/item/front/card/index.js | 2 +- modules/item/front/card/index.spec.js | 8 +- modules/item/front/create/index.html | 8 +- modules/item/front/create/index.spec.js | 4 +- .../item/front/descriptor-popover/index.js | 2 +- .../front/descriptor-popover/index.spec.js | 8 +- modules/item/front/descriptor/index.html | 2 +- modules/item/front/descriptor/index.js | 4 +- modules/item/front/diary/index.html | 4 +- modules/item/front/diary/index.spec.js | 4 +- modules/item/front/index/index.html | 2 +- modules/item/front/index/index.js | 2 +- modules/item/front/index/index.spec.js | 8 +- modules/item/front/last-entries/index.html | 2 +- modules/item/front/log/index.html | 2 +- modules/item/front/niche/index.html | 4 +- .../front/request-search-panel/index.html | 4 +- modules/item/front/request/index.html | 2 +- modules/item/front/request/index.js | 6 +- modules/item/front/request/index.spec.js | 16 ++- modules/item/front/search-panel/index.html | 6 +- modules/item/front/search-panel/index.js | 8 +- modules/item/front/search-panel/index.spec.js | 8 +- modules/item/front/summary/index.js | 2 +- modules/item/front/summary/index.spec.js | 8 +- modules/item/front/tags/index.html | 4 +- modules/item/front/tags/index.js | 4 +- modules/item/front/tags/index.spec.js | 8 +- modules/item/front/tax/index.html | 2 +- modules/item/front/tax/index.js | 4 +- modules/item/front/tax/index.spec.js | 10 +- modules/order/front/basic-data/index.html | 8 +- modules/order/front/basic-data/index.spec.js | 13 +- modules/order/front/card/index.js | 4 +- modules/order/front/card/index.spec.js | 12 +- .../front/catalog-search-panel/index.html | 2 +- modules/order/front/catalog/index.html | 2 +- modules/order/front/catalog/index.spec.js | 4 +- modules/order/front/create/card.html | 4 +- modules/order/front/create/card.js | 6 +- modules/order/front/create/card.spec.js | 16 ++- modules/order/front/create/index.spec.js | 4 +- modules/order/front/descriptor/index.js | 2 +- modules/order/front/descriptor/index.spec.js | 8 +- modules/order/front/filter/index.html | 2 +- modules/order/front/filter/index.js | 2 +- modules/order/front/filter/index.spec.js | 6 +- modules/order/front/index/index.html | 2 +- modules/order/front/line/index.js | 8 +- modules/order/front/line/index.spec.js | 10 +- modules/order/front/prices-popover/index.js | 4 +- modules/order/front/search-panel/index.html | 6 +- modules/order/front/summary/index.js | 2 +- modules/order/front/summary/index.spec.js | 8 +- modules/order/front/volume/index.html | 4 +- modules/order/front/volume/index.js | 2 +- modules/order/front/volume/index.spec.js | 8 +- modules/route/front/basic-data/index.html | 8 +- modules/route/front/card/index.js | 2 +- modules/route/front/create/index.html | 8 +- modules/route/front/descriptor/index.js | 6 +- modules/route/front/index/index.html | 2 +- modules/route/front/log/index.html | 2 +- modules/route/front/search-panel/index.html | 8 +- modules/route/front/summary/index.js | 2 +- modules/route/front/summary/index.spec.js | 8 +- modules/route/front/tickets/index.html | 4 +- modules/route/front/tickets/index.js | 8 +- modules/route/front/tickets/index.spec.js | 12 +- .../front/basic-data/step-one/index.html | 10 +- .../ticket/front/basic-data/step-one/index.js | 10 +- .../front/basic-data/step-one/index.spec.js | 24 ++-- .../front/basic-data/step-three/index.html | 2 +- .../front/basic-data/step-three/index.js | 2 +- .../front/basic-data/step-three/index.spec.js | 8 +- .../front/basic-data/step-two/index.spec.js | 4 +- modules/ticket/front/card/index.js | 4 +- modules/ticket/front/card/index.spec.js | 12 +- modules/ticket/front/component/index.html | 2 +- modules/ticket/front/component/index.spec.js | 4 +- modules/ticket/front/create/card.html | 6 +- modules/ticket/front/create/card.js | 6 +- .../ticket/front/descriptor-popover/index.js | 2 +- .../front/descriptor-popover/index.spec.js | 8 +- .../ticket/front/descriptor/addStowaway.html | 2 +- .../ticket/front/descriptor/addStowaway.js | 2 +- modules/ticket/front/descriptor/index.js | 16 +-- modules/ticket/front/descriptor/index.spec.js | 26 ++-- .../ticket/front/descriptor/removeStowaway.js | 4 +- modules/ticket/front/dms/create/index.html | 6 +- modules/ticket/front/dms/create/index.js | 6 +- modules/ticket/front/dms/create/index.spec.js | 12 +- modules/ticket/front/dms/edit/index.html | 6 +- modules/ticket/front/dms/edit/index.js | 6 +- modules/ticket/front/dms/edit/index.spec.js | 12 +- modules/ticket/front/dms/index/index.html | 6 +- modules/ticket/front/dms/index/index.js | 2 +- modules/ticket/front/dms/index/index.spec.js | 8 +- modules/ticket/front/expedition/index.html | 2 +- modules/ticket/front/expedition/index.js | 2 +- modules/ticket/front/expedition/index.spec.js | 8 +- modules/ticket/front/index/index.html | 2 +- modules/ticket/front/index/index.spec.js | 4 +- modules/ticket/front/log/index.html | 2 +- modules/ticket/front/note/index.html | 4 +- modules/ticket/front/package/index.html | 4 +- modules/ticket/front/picture/index.html | 2 +- .../ticket/front/request/create/index.html | 4 +- modules/ticket/front/request/index/index.html | 2 +- modules/ticket/front/sale-checked/index.html | 2 +- modules/ticket/front/sale-tracking/index.html | 2 +- modules/ticket/front/sale/editDiscount.js | 2 +- modules/ticket/front/sale/index.html | 6 +- modules/ticket/front/sale/index.js | 32 ++--- .../front/sale/specs/editDiscount.spec.js | 6 +- modules/ticket/front/sale/specs/index.spec.js | 114 +++++++++--------- modules/ticket/front/search-panel/index.html | 12 +- modules/ticket/front/services/index.html | 6 +- modules/ticket/front/services/index.js | 4 +- modules/ticket/front/services/index.spec.js | 10 +- modules/ticket/front/summary/index.js | 4 +- modules/ticket/front/summary/index.spec.js | 8 +- modules/ticket/front/tracking/edit/index.html | 6 +- modules/ticket/front/tracking/edit/index.js | 4 +- .../ticket/front/tracking/edit/index.spec.js | 8 +- .../ticket/front/tracking/index/index.html | 2 +- modules/ticket/front/volume/index.html | 6 +- modules/ticket/front/volume/index.spec.js | 8 +- modules/ticket/front/weekly/create/index.html | 10 +- .../ticket/front/weekly/create/index.spec.js | 4 +- modules/ticket/front/weekly/index/index.html | 2 +- modules/ticket/front/weekly/index/index.js | 4 +- modules/travel/front/index/index.html | 2 +- modules/travel/front/search-panel/index.html | 6 +- modules/worker/front/account/index.html | 4 +- modules/worker/front/basic-data/index.html | 2 +- modules/worker/front/calendar/index.html | 2 +- modules/worker/front/calendar/index.js | 2 +- modules/worker/front/calendar/index.spec.js | 10 +- modules/worker/front/card/index.js | 2 +- modules/worker/front/department/index.html | 2 +- modules/worker/front/department/index.js | 6 +- .../worker/front/descriptor-popover/index.js | 2 +- .../front/descriptor-popover/index.spec.js | 8 +- modules/worker/front/index/index.html | 2 +- modules/worker/front/pbx/index.js | 2 +- modules/worker/front/phones/index.html | 4 +- modules/worker/front/phones/index.spec.js | 4 +- modules/worker/front/search-panel/index.html | 2 +- modules/worker/front/summary/index.js | 2 +- modules/worker/front/time-control/index.html | 2 +- modules/worker/front/time-control/index.js | 2 +- .../worker/front/time-control/index.spec.js | 7 +- 334 files changed, 854 insertions(+), 1069 deletions(-) diff --git a/front/core/components/autocomplete/index.spec.js b/front/core/components/autocomplete/index.spec.js index 7417ea2d8..847761179 100644 --- a/front/core/components/autocomplete/index.spec.js +++ b/front/core/components/autocomplete/index.spec.js @@ -3,9 +3,7 @@ describe('Component vnAutocomplete', () => { let controller; let data = {id: 1, name: 'Bruce Wayne'}; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/button-menu/index.spec.js b/front/core/components/button-menu/index.spec.js index ee8e3fd5e..1e8c048ff 100644 --- a/front/core/components/button-menu/index.spec.js +++ b/front/core/components/button-menu/index.spec.js @@ -2,9 +2,7 @@ describe('Component vnButtonMenu', () => { let controller; let $element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/calendar/index.spec.js b/front/core/components/calendar/index.spec.js index 696f80d3c..6945c35ea 100644 --- a/front/core/components/calendar/index.spec.js +++ b/front/core/components/calendar/index.spec.js @@ -6,9 +6,7 @@ describe('Component vnCalendar', () => { date.setHours(0, 0, 0, 0); date.setDate(1); - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(` { let $ctrl; let element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/chip/index.spec.js b/front/core/components/chip/index.spec.js index eaf6ff8c5..8555f2c11 100644 --- a/front/core/components/chip/index.spec.js +++ b/front/core/components/chip/index.spec.js @@ -6,9 +6,7 @@ describe('Component vnChip', () => { let $scope; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); diff --git a/front/core/components/date-picker/index.spec.js b/front/core/components/date-picker/index.spec.js index 38d344fc9..411a92105 100644 --- a/front/core/components/date-picker/index.spec.js +++ b/front/core/components/date-picker/index.spec.js @@ -3,9 +3,7 @@ describe('Component vnDatePicker', () => { let $element; let $ctrl; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => { $filter = _$filter_; diff --git a/front/core/components/dialog/dialog.spec.js b/front/core/components/dialog/dialog.spec.js index 83d749328..b889f1bc0 100644 --- a/front/core/components/dialog/dialog.spec.js +++ b/front/core/components/dialog/dialog.spec.js @@ -2,9 +2,7 @@ describe('Component vnDialog', () => { let $element; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject($componentController => { $element = angular.element(''); diff --git a/front/core/components/drop-down/drop-down.spec.js b/front/core/components/drop-down/drop-down.spec.js index 0172b848b..6bfdd6500 100644 --- a/front/core/components/drop-down/drop-down.spec.js +++ b/front/core/components/drop-down/drop-down.spec.js @@ -2,9 +2,7 @@ describe('Component vnDropDown', () => { let $element; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope, $document) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/input-file/index.spec.js b/front/core/components/input-file/index.spec.js index cbf5913a4..8ec995137 100644 --- a/front/core/components/input-file/index.spec.js +++ b/front/core/components/input-file/index.spec.js @@ -7,9 +7,7 @@ describe('Component vnInputFile', () => { let $element; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); diff --git a/front/core/components/input-number/index.spec.js b/front/core/components/input-number/index.spec.js index 9d1943e0e..d1bbe251c 100644 --- a/front/core/components/input-number/index.spec.js +++ b/front/core/components/input-number/index.spec.js @@ -4,9 +4,7 @@ describe('Component vnInputNumber', () => { let $element; let $ctrl; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/input-time/index.spec.js b/front/core/components/input-time/index.spec.js index 0ab0fc762..39993b5cc 100644 --- a/front/core/components/input-time/index.spec.js +++ b/front/core/components/input-time/index.spec.js @@ -5,9 +5,7 @@ describe('Component vnInputTime', () => { let $element; let $ctrl; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope, _$filter_) => { $filter = _$filter_; diff --git a/front/core/components/label-value/label-value.spec.js b/front/core/components/label-value/label-value.spec.js index 8093d0c87..6b64e8c37 100644 --- a/front/core/components/label-value/label-value.spec.js +++ b/front/core/components/label-value/label-value.spec.js @@ -5,9 +5,7 @@ describe('Component vnInputTime', () => { let $element; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject($componentController => { const $attrs = {}; diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index d2ac91b2a..c85b160c1 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -5,9 +5,7 @@ describe('Component vnMultiCheck', () => { let controller; let $element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject($componentController => { $element = angular.element(`
`); diff --git a/front/core/components/popover/popover.spec.js b/front/core/components/popover/popover.spec.js index fd92fd4ab..54901b222 100644 --- a/front/core/components/popover/popover.spec.js +++ b/front/core/components/popover/popover.spec.js @@ -4,9 +4,7 @@ describe('Component vnPopover', () => { let $parent; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope, $document) => { $element = $compile(`test`)($rootScope); diff --git a/front/core/components/radio/index.spec.js b/front/core/components/radio/index.spec.js index 1d5d490a8..5a512c8ba 100644 --- a/front/core/components/radio/index.spec.js +++ b/front/core/components/radio/index.spec.js @@ -3,9 +3,7 @@ describe('Component vnRadio', () => { let $ctrl; let element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(` { let $state; let $scope; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($componentController, _$state_, $rootScope, $compile) => { $scope = $rootScope.$new(); diff --git a/front/core/components/spinner/spinner.spec.js b/front/core/components/spinner/spinner.spec.js index 437139c8c..dbcdb0acd 100644 --- a/front/core/components/spinner/spinner.spec.js +++ b/front/core/components/spinner/spinner.spec.js @@ -4,9 +4,7 @@ describe('Component vnSpinner', () => { let $element; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/step-control/step-control.spec.js b/front/core/components/step-control/step-control.spec.js index f309c40b2..944457cfe 100644 --- a/front/core/components/step-control/step-control.spec.js +++ b/front/core/components/step-control/step-control.spec.js @@ -4,9 +4,7 @@ describe('Component vnStepControl', () => { let controller; let $state; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($componentController, _$state_) => { $state = _$state_; diff --git a/front/core/components/table/index.spec.js b/front/core/components/table/index.spec.js index b0c92cee0..40e1ef74e 100644 --- a/front/core/components/table/index.spec.js +++ b/front/core/components/table/index.spec.js @@ -5,9 +5,7 @@ describe('Component vnTable', () => { let $element; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); diff --git a/front/core/components/textarea/index.spec.js b/front/core/components/textarea/index.spec.js index 1d246cfe0..7b7547b6b 100644 --- a/front/core/components/textarea/index.spec.js +++ b/front/core/components/textarea/index.spec.js @@ -4,9 +4,7 @@ describe('Component vnTextarea', () => { let $element; let $ctrl; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/th/index.spec.js b/front/core/components/th/index.spec.js index 6ab2652e7..dc9e43672 100644 --- a/front/core/components/th/index.spec.js +++ b/front/core/components/th/index.spec.js @@ -5,9 +5,7 @@ describe('Component vnTh', () => { let controller; let $element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject($componentController => { $element = angular.element(`
${template}
`); diff --git a/front/core/components/tooltip/tooltip.spec.js b/front/core/components/tooltip/tooltip.spec.js index 25689cfcf..15595c61b 100644 --- a/front/core/components/tooltip/tooltip.spec.js +++ b/front/core/components/tooltip/tooltip.spec.js @@ -8,9 +8,7 @@ xdescribe('Component vnTooltip', () => { let element; let window; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($componentController, $compile, $templateRequest, $document) => { $element = angular.element(`test`); diff --git a/front/core/components/treeview/index.spec.js b/front/core/components/treeview/index.spec.js index 87796f06e..e03345c33 100644 --- a/front/core/components/treeview/index.spec.js +++ b/front/core/components/treeview/index.spec.js @@ -2,9 +2,7 @@ describe('Component vnTreeview', () => { let controller; let $element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($compile, $rootScope) => { $element = $compile(``)($rootScope); diff --git a/front/core/components/watcher/watcher.spec.js b/front/core/components/watcher/watcher.spec.js index 32de7dda7..0be4cc975 100644 --- a/front/core/components/watcher/watcher.spec.js +++ b/front/core/components/watcher/watcher.spec.js @@ -10,9 +10,7 @@ describe('Component vnWatcher', () => { let $attrs; let $q; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$state_, _$q_) => { $scope = $rootScope.$new(); diff --git a/front/core/directives/specs/acl.spec.js b/front/core/directives/specs/acl.spec.js index a7884a12d..94000d543 100644 --- a/front/core/directives/specs/acl.spec.js +++ b/front/core/directives/specs/acl.spec.js @@ -4,12 +4,10 @@ describe('Directive acl', () => { let element; let compile; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(($httpBackend, aclService) => { - $httpBackend.whenGET('/api/Accounts/acl') + $httpBackend.whenGET('Accounts/acl') .respond({ user: {id: 1, name: 'myUser'}, roles: [ diff --git a/front/core/directives/specs/bind.spec.js b/front/core/directives/specs/bind.spec.js index 8a34ad1d8..d8d2cb359 100644 --- a/front/core/directives/specs/bind.spec.js +++ b/front/core/directives/specs/bind.spec.js @@ -1,9 +1,7 @@ describe('Directive bind', () => { let compile; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); compile = html => { inject(($compile, $rootScope) => { diff --git a/front/core/directives/specs/dialog.spec.js b/front/core/directives/specs/dialog.spec.js index 483870588..670b28128 100644 --- a/front/core/directives/specs/dialog.spec.js +++ b/front/core/directives/specs/dialog.spec.js @@ -5,9 +5,7 @@ describe('Directive dialog', () => { let compile; let controller; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); compile = _element => { inject(($compile, $rootScope) => { diff --git a/front/core/directives/specs/focus.spec.js b/front/core/directives/specs/focus.spec.js index 4034657b4..82cd7d84d 100644 --- a/front/core/directives/specs/focus.spec.js +++ b/front/core/directives/specs/focus.spec.js @@ -3,9 +3,7 @@ describe('Directive focus', () => { let $element; let compile; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); compile = (_element, _childElement) => { inject(($compile, $rootScope) => { diff --git a/front/core/directives/specs/id.spec.js b/front/core/directives/specs/id.spec.js index dcadae2d5..9d400701a 100644 --- a/front/core/directives/specs/id.spec.js +++ b/front/core/directives/specs/id.spec.js @@ -4,9 +4,7 @@ describe('Directive vnId', () => { let $element; let compile; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); compile = _element => { inject(($compile, $rootScope) => { diff --git a/front/core/directives/specs/rule.spec.js b/front/core/directives/specs/rule.spec.js index f3671a5e2..522ca5637 100644 --- a/front/core/directives/specs/rule.spec.js +++ b/front/core/directives/specs/rule.spec.js @@ -3,9 +3,7 @@ describe('Directive rule', () => { let $element; let element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); function compile(html, value) { inject(($compile, $rootScope, $window) => { diff --git a/front/core/directives/specs/zoom-image.spec.js b/front/core/directives/specs/zoom-image.spec.js index 08acb3b34..f9d9c1801 100644 --- a/front/core/directives/specs/zoom-image.spec.js +++ b/front/core/directives/specs/zoom-image.spec.js @@ -5,9 +5,7 @@ describe('Directive zoomImage', () => { let srcZoom = 'http://zoom.img.jpg/'; let findContainer; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject(($compile, $rootScope) => { compile = $compile; diff --git a/front/core/directives/uvc.js b/front/core/directives/uvc.js index 664dfae53..e464a93ab 100644 --- a/front/core/directives/uvc.js +++ b/front/core/directives/uvc.js @@ -23,7 +23,7 @@ export function directive($http, $compile, vnApp, $translate) { } function getTableConfig(tableCode) { - return $http.get(`/api/UserConfigViews/getConfig?tableCode=${tableCode}`); + return $http.get(`UserConfigViews/getConfig?tableCode=${tableCode}`); } function createViewConfig(config, fields) { @@ -73,7 +73,7 @@ export function directive($http, $compile, vnApp, $translate) { function saveConfiguration(tableConfiguration) { tableConfiguration.configuration = JSON.parse(JSON.stringify(tableConfiguration.configuration)); - return $http.post(`/api/UserConfigViews/save`, tableConfiguration); + return $http.post(`UserConfigViews/save`, tableConfiguration); } return { diff --git a/front/core/filters/specs/currency.spec.js b/front/core/filters/specs/currency.spec.js index 2d7c0a514..28a4a3640 100644 --- a/front/core/filters/specs/currency.spec.js +++ b/front/core/filters/specs/currency.spec.js @@ -2,9 +2,7 @@ describe('Currency filter', () => { let compile; let $element; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); compile = html => { inject(($compile, $rootScope) => { diff --git a/front/core/lib/specs/acl-service.spec.js b/front/core/lib/specs/acl-service.spec.js index ed15357bd..7756347b0 100644 --- a/front/core/lib/specs/acl-service.spec.js +++ b/front/core/lib/specs/acl-service.spec.js @@ -1,12 +1,10 @@ describe('Service acl', () => { let aclService; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject((_aclService_, $httpBackend) => { - $httpBackend.when('GET', `/api/Accounts/acl`).respond({ + $httpBackend.when('GET', `Accounts/acl`).respond({ roles: [ {role: {name: 'foo'}}, {role: {name: 'bar'}}, diff --git a/front/core/lib/specs/module-loader.spec.js b/front/core/lib/specs/module-loader.spec.js index 1bb422c42..4a02c1bcc 100644 --- a/front/core/lib/specs/module-loader.spec.js +++ b/front/core/lib/specs/module-loader.spec.js @@ -1,9 +1,7 @@ describe('factory vnModuleLoader', () => { let vnModuleLoader; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(angular.mock.inject((_vnModuleLoader_, $rootScope, $window) => { vnModuleLoader = _vnModuleLoader_; diff --git a/front/core/lib/specs/validator.spec.js b/front/core/lib/specs/validator.spec.js index c61faa793..dd8fc985d 100644 --- a/front/core/lib/specs/validator.spec.js +++ b/front/core/lib/specs/validator.spec.js @@ -3,9 +3,7 @@ import {validate} from '../validator.js'; describe('Validator', () => { let $translate; - beforeEach(angular.mock.module('vnCore', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('vnCore')); beforeEach(inject(_$translate_ => { $translate = _$translate_; diff --git a/front/core/module.js b/front/core/module.js index b9fd9f6a8..7a955777d 100644 --- a/front/core/module.js +++ b/front/core/module.js @@ -9,8 +9,8 @@ export default ngModule; * to the component controller class with the merged component options. To * retrieve parent options, it reads the same property of the parent class, so * for the parent options to be copied, it must have been declared using this - * same function. If any of the options (template, transclude, bindings ...) is - * redeclared in the child component, it has preference. + * same function. If any of the options (template, transclude, bindings...) is + * redeclared in the child component, the last has preference. * * @param {String} name Coponent name in camelCase * @param {Object} options The component options @@ -32,6 +32,10 @@ ngModule.vnComponent = function(name, options) { bindings: Object.assign({}, parentOptions.bindings, options.bindings + ), + require: Object.assign({}, + parentOptions.require, + options.require ) } ); diff --git a/front/core/services/acl-service.js b/front/core/services/acl-service.js index 24de35a57..ee4404d34 100644 --- a/front/core/services/acl-service.js +++ b/front/core/services/acl-service.js @@ -11,7 +11,7 @@ class AclService { } load() { - return this.$http.get('/api/Accounts/acl').then(res => { + return this.$http.get('Accounts/acl').then(res => { this.user = res.data.user; this.roles = {}; diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 1bf9a1015..f59c4c0dd 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -53,7 +53,7 @@ export default class Auth { password: password || undefined }; - return this.$http.post('/api/Accounts/login', params).then( + return this.$http.post('Accounts/login', params).then( json => this.onLoginOk(json, remember)); } @@ -70,7 +70,7 @@ export default class Auth { } logout() { - let promise = this.$http.post('/api/Accounts/logout', null, { + let promise = this.$http.post('Accounts/logout', null, { headers: {Authorization: this.vnToken.token} }).catch(() => {}); diff --git a/front/core/services/config.js b/front/core/services/config.js index e2d3035fb..8fa07e85c 100644 --- a/front/core/services/config.js +++ b/front/core/services/config.js @@ -25,7 +25,7 @@ export default class Config { for (let param of this.params) this.local[param] = this.getItem(param); - return this.$http.get('api/UserConfigs/getUserConfig') + return this.$http.get('UserConfigs/getUserConfig') .then(res => { for (let param of this.params) this.user[param] = res.data[param]; @@ -47,7 +47,7 @@ export default class Config { this.mergeParams(); let params = {[param]: value}; - return this.$http.post('api/UserConfigs/setUserConfig', params) + return this.$http.post('UserConfigs/setUserConfig', params) .then(() => this.showSaved()); } diff --git a/front/core/services/interceptor.js b/front/core/services/interceptor.js index 23e065392..448b70a34 100644 --- a/front/core/services/interceptor.js +++ b/front/core/services/interceptor.js @@ -3,10 +3,17 @@ import HttpError from 'core/lib/http-error'; interceptor.$inject = ['$q', 'vnApp', 'vnToken', '$translate']; function interceptor($q, vnApp, vnToken, $translate) { + let apiPath = 'api/'; + return { - request: function(config) { + setApiPath(path) { + apiPath = path; + }, + request(config) { vnApp.pushLoader(); + if (config.url.charAt(0) !== '/' && apiPath) + config.url = `${apiPath}/${config.url}`; if (vnToken.token) config.headers.Authorization = vnToken.token; if ($translate.use()) @@ -14,14 +21,14 @@ function interceptor($q, vnApp, vnToken, $translate) { return config; }, - requestError: function(rejection) { + requestError(rejection) { return $q.reject(rejection); }, - response: function(response) { + response(response) { vnApp.popLoader(); return response; }, - responseError: function(rejection) { + responseError(rejection) { vnApp.popLoader(); let err = new HttpError(rejection.statusText); Object.assign(err, rejection); diff --git a/front/salix/components/left-menu/left-menu.spec.js b/front/salix/components/left-menu/left-menu.spec.js index 76a6d10f8..12846d2e3 100644 --- a/front/salix/components/left-menu/left-menu.spec.js +++ b/front/salix/components/left-menu/left-menu.spec.js @@ -4,9 +4,7 @@ describe('Component vnLeftMenu', () => { let controller; let $element; - beforeEach(angular.mock.module('salix', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('salix')); beforeEach(angular.mock.inject(($componentController, $state, $window) => { $element = angular.element('
'); diff --git a/front/salix/components/main-menu/main-menu.js b/front/salix/components/main-menu/main-menu.js index 9c2888c1b..93ff955e7 100644 --- a/front/salix/components/main-menu/main-menu.js +++ b/front/salix/components/main-menu/main-menu.js @@ -16,7 +16,7 @@ export default class MainMenu { } getCurrentUserName() { - this.$http.get('/api/Accounts/getCurrentUserData').then(json => { + this.$http.get('Accounts/getCurrentUserData').then(json => { this.$.$root.user = json.data; window.localStorage.currentUserWorkerId = json.data.workerId; }); diff --git a/front/salix/components/main-menu/main-menu.spec.js b/front/salix/components/main-menu/main-menu.spec.js index b695e2795..693bf8291 100644 --- a/front/salix/components/main-menu/main-menu.spec.js +++ b/front/salix/components/main-menu/main-menu.spec.js @@ -4,9 +4,7 @@ describe('Component vnMainMenu', () => { let $httpBackend; let controller; - beforeEach(angular.mock.module('salix', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('salix')); beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { let vnModules = {get: () => {}}; @@ -16,8 +14,8 @@ describe('Component vnMainMenu', () => { describe('getCurrentUserName()', () => { it(`should set the user name property in the controller`, () => { - $httpBackend.when('GET', `/api/Accounts/getCurrentUserData`).respond({name: 'batman'}); - $httpBackend.expect('GET', `/api/Accounts/getCurrentUserData`); + $httpBackend.when('GET', `Accounts/getCurrentUserData`).respond({name: 'batman'}); + $httpBackend.expect('GET', `Accounts/getCurrentUserData`); controller.getCurrentUserName(); $httpBackend.flush(); diff --git a/front/salix/components/user-popover/index.html b/front/salix/components/user-popover/index.html index 9f4f931bd..b6ce8b1cd 100644 --- a/front/salix/components/user-popover/index.html +++ b/front/salix/components/user-popover/index.html @@ -1,11 +1,11 @@ @@ -41,7 +41,7 @@ label="Local bank" id="localBank" ng-model="$ctrl.localBankFk" - url="/api/Banks" + url="Banks" select-fields="['id','bank']" show-field="bank" order="id" diff --git a/front/salix/components/user-popover/index.spec.js b/front/salix/components/user-popover/index.spec.js index 393c2ade6..217471ca5 100644 --- a/front/salix/components/user-popover/index.spec.js +++ b/front/salix/components/user-popover/index.spec.js @@ -5,12 +5,10 @@ describe('Salix', () => { let controller; let $scope; - beforeEach(angular.mock.module('salix', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('salix')); beforeEach(angular.mock.inject(($componentController, $rootScope, $httpBackend) => { - $httpBackend.expectGET('api/UserConfigs/getUserConfig'); + $httpBackend.expectGET('UserConfigs/getUserConfig'); $scope = $rootScope.$new(); controller = $componentController('vnUserPopover', {$scope}); diff --git a/jest-front.js b/jest-front.js index 9f2a041de..40c0e52fc 100644 --- a/jest-front.js +++ b/jest-front.js @@ -1,6 +1,6 @@ import 'angular'; import 'angular-mocks'; -import './front/core/module.js'; +import core from './front/core/module.js'; import './front/salix/components/app/app.js'; import './modules/agency/front/module.js'; import './modules/claim/front/module.js'; @@ -12,3 +12,23 @@ import './modules/route/front/module.js'; import './modules/ticket/front/module.js'; import './modules/travel/front/module.js'; import './modules/worker/front/module.js'; + +core.run(vnInterceptor => { + vnInterceptor.setApiPath(null); +}); + +window.ngModule = function(moduleName) { + return angular.mock.module(moduleName, function($provide, $translateProvider) { + // Avoid unexpected request warnings caused by angular translate + // https://angular-translate.github.io/docs/#/guide/22_unit-testing-with-angular-translate + $provide.factory('customLocaleLoader', function($q) { + return function() { + let deferred = $q.defer(); + deferred.resolve({}); + return deferred.promise; + }; + }); + + $translateProvider.useLoader('customLocaleLoader'); + }); +}; diff --git a/modules/agency/front/basic-data/index.html b/modules/agency/front/basic-data/index.html index ec652c0e7..b0f94ddc0 100644 --- a/modules/agency/front/basic-data/index.html +++ b/modules/agency/front/basic-data/index.html @@ -1,4 +1,4 @@ - + { if (res.data) this.zone = res.data; diff --git a/modules/agency/front/card/index.spec.js b/modules/agency/front/card/index.spec.js index 729c3d75b..190b77d0d 100644 --- a/modules/agency/front/card/index.spec.js +++ b/modules/agency/front/card/index.spec.js @@ -6,9 +6,7 @@ describe('Agency Component vnZoneCard', () => { let $httpBackend; let $stateParams; - beforeEach(angular.mock.module('agency', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('agency')); beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; @@ -26,7 +24,7 @@ describe('Agency Component vnZoneCard', () => { } }; let json = encodeURIComponent(JSON.stringify(filter)); - $httpBackend.expectGET(`/agency/api/Zones/1?filter=${json}`).respond({id: 1}); + $httpBackend.expectGET(`Zones/1?filter=${json}`).respond({id: 1}); controller.getCard(); $httpBackend.flush(); diff --git a/modules/agency/front/create/index.html b/modules/agency/front/create/index.html index 18b6a459e..716d5e50c 100644 --- a/modules/agency/front/create/index.html +++ b/modules/agency/front/create/index.html @@ -1,4 +1,4 @@ - + { let $state; let controller; - beforeEach(angular.mock.module('agency', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('agency')); beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => { $scope = $rootScope.$new(); diff --git a/modules/agency/front/delivery-days/index.html b/modules/agency/front/delivery-days/index.html index af71f75d0..286721068 100644 --- a/modules/agency/front/delivery-days/index.html +++ b/modules/agency/front/delivery-days/index.html @@ -6,7 +6,7 @@ vn-one label="Agency" ng-model="$ctrl.params.agencyModeFk" - url="/api/AgencyModes/isActive"> + url="AgencyModes/isActive"> @@ -14,7 +14,7 @@ vn-one label="Province" ng-model="$ctrl.params.provinceFk" - url="/api/Provinces" + url="Provinces" fields="['countryFk']" include="'country'" style="margin-right: .5em;"> diff --git a/modules/agency/front/delivery-days/index.js b/modules/agency/front/delivery-days/index.js index 12e0c4b30..cebfdbf7e 100644 --- a/modules/agency/front/delivery-days/index.js +++ b/modules/agency/front/delivery-days/index.js @@ -10,7 +10,7 @@ class Controller { } onSubmit() { - this.$http.get(`/api/Zones/getEvents`, {params: this.params}) + this.$http.get(`Zones/getEvents`, {params: this.params}) .then(res => this.$.data = res.data); } } diff --git a/modules/agency/front/descriptor/index.js b/modules/agency/front/descriptor/index.js index c8d6bbc26..9a0513855 100644 --- a/modules/agency/front/descriptor/index.js +++ b/modules/agency/front/descriptor/index.js @@ -20,7 +20,7 @@ class Controller { returnDialog(response) { if (response === 'ACCEPT') { - this.$http.delete(`/agency/api/Zones/${this.zone.id}`).then(() => { + this.$http.delete(`Zones/${this.zone.id}`).then(() => { this.$state.go('zone.index'); }); } diff --git a/modules/agency/front/edit/index.html b/modules/agency/front/edit/index.html index dbe0a5edf..f66c289ee 100644 --- a/modules/agency/front/edit/index.html +++ b/modules/agency/front/edit/index.html @@ -1,4 +1,4 @@ - + { if (res && res.data) this.$state.go('zone.card.basicData', {id: res.data.id}); diff --git a/modules/agency/front/index/index.spec.js b/modules/agency/front/index/index.spec.js index c4ffb975e..57e17acc8 100644 --- a/modules/agency/front/index/index.spec.js +++ b/modules/agency/front/index/index.spec.js @@ -4,9 +4,7 @@ describe('Agency Component vnZoneIndex', () => { let $componentController; let controller; - beforeEach(angular.mock.module('agency', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('agency')); beforeEach(angular.mock.inject(_$componentController_ => { $componentController = _$componentController_; diff --git a/modules/agency/front/location-search-panel/index.html b/modules/agency/front/location-search-panel/index.html index d8ce27934..57f661ddf 100644 --- a/modules/agency/front/location-search-panel/index.html +++ b/modules/agency/front/location-search-panel/index.html @@ -20,7 +20,7 @@ vn-one label="Agency" ng-model="filter.agencyModeFk" - url="/agency/api/AgencyModes/isActive" + url="AgencyModes/isActive" show-field="name" value-field="id"> @@ -28,7 +28,7 @@ vn-one label="Warehouse" ng-model="filter.warehouseFk" - url="/agency/api/Warehouses" + url="Warehouses" show-field="name" value-field="id"> diff --git a/modules/agency/front/location/index.html b/modules/agency/front/location/index.html index ca885a6b4..6882ccc5b 100644 --- a/modules/agency/front/location/index.html +++ b/modules/agency/front/location/index.html @@ -1,6 +1,6 @@
diff --git a/modules/agency/front/location/index.js b/modules/agency/front/location/index.js index 591de5f5c..aff9dbe77 100644 --- a/modules/agency/front/location/index.js +++ b/modules/agency/front/location/index.js @@ -40,7 +40,7 @@ class Controller extends Component { if (value == null) value = undefined; const params = {geoId: item.id, isIncluded: value}; - const path = `/api/zones/${this.zone.id}/toggleIsIncluded`; + const path = `zones/${this.zone.id}/toggleIsIncluded`; this.$http.post(path, params); } } diff --git a/modules/agency/front/search-panel/index.html b/modules/agency/front/search-panel/index.html index e27e4c4b1..1fd07cbf5 100644 --- a/modules/agency/front/search-panel/index.html +++ b/modules/agency/front/search-panel/index.html @@ -21,7 +21,7 @@ vn-one label="Agency" ng-model="filter.agencyModeFk" - url="/api/AgencyModes/isActive" + url="AgencyModes/isActive" show-field="name" value-field="id"> diff --git a/modules/agency/front/summary/index.js b/modules/agency/front/summary/index.js index 162e679d9..992e23937 100644 --- a/modules/agency/front/summary/index.js +++ b/modules/agency/front/summary/index.js @@ -23,7 +23,7 @@ class Controller { where: {id: this.zone.id} }; filter = encodeURIComponent(JSON.stringify((filter))); - this.$http.get(`/agency/api/Zones/findOne?filter=${filter}`).then(res => { + this.$http.get(`Zones/findOne?filter=${filter}`).then(res => { if (res && res.data) this.summary = res.data; }); diff --git a/modules/agency/front/warehouses/index.html b/modules/agency/front/warehouses/index.html index 063c6993b..84481083b 100644 --- a/modules/agency/front/warehouses/index.html +++ b/modules/agency/front/warehouses/index.html @@ -33,7 +33,7 @@ diff --git a/modules/agency/front/warehouses/index.js b/modules/agency/front/warehouses/index.js index b1697ee31..69d2b506c 100644 --- a/modules/agency/front/warehouses/index.js +++ b/modules/agency/front/warehouses/index.js @@ -5,7 +5,7 @@ class Controller extends Component { constructor($element, $) { super($element, $); - this.path = `/api/Zones/${this.$params.id}/warehouses`; + this.path = `Zones/${this.$params.id}/warehouses`; this.refresh(); } diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 04ab71997..5ec60dcf2 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -1,11 +1,11 @@ @@ -161,7 +161,7 @@ diff --git a/modules/claim/front/action/index.js b/modules/claim/front/action/index.js index 63b283f1f..6354ea374 100644 --- a/modules/claim/front/action/index.js +++ b/modules/claim/front/action/index.js @@ -35,7 +35,7 @@ class Controller { getClaimedSales() { let json = encodeURIComponent(JSON.stringify(this.claim.id)); - let query = `/claim/api/ClaimBeginnings/${json}`; + let query = `ClaimBeginnings/${json}`; this.$http.get(query).then(res => { if (res.data) this.claimedSales = res.data; @@ -44,7 +44,7 @@ class Controller { addClaimedSale(saleFk) { let saleToAdd = {saleFk: saleFk, claimFk: this.claim.id, workerFk: this.claim.workerFk, claimDestinationFk: 1}; - let query = `claim/api/ClaimEnds/`; + let query = `ClaimEnds/`; this.$http.post(query, saleToAdd).then(() => { this.$.model.refresh(); this.$.addSales.hide(); @@ -54,7 +54,7 @@ class Controller { deleteClaimedSale(id) { let json = encodeURIComponent(JSON.stringify(id)); - let query = `claim/api/ClaimEnds/${json}`; + let query = `ClaimEnds/${json}`; this.$http.delete(query).then(() => { this.$.model.refresh(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); @@ -62,7 +62,7 @@ class Controller { } importToNewRefundTicket() { - let query = `claim/api/ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`; + let query = `ClaimBeginnings/${this.$stateParams.id}/importToNewRefundTicket`; return this.$http.post(query).then(() => { this.$.model.refresh(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); @@ -113,7 +113,7 @@ class Controller { importTicketLines(ticketFk) { let data = {claimFk: this.$stateParams.id, ticketFk: ticketFk}; - let query = `/claim/api/ClaimEnds/importTicketSales`; + let query = `ClaimEnds/importTicketSales`; this.$http.post(query, data).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.$.lastTicketsPopover.hide(); @@ -123,7 +123,7 @@ class Controller { regularize() { let data = {claimFk: this.$stateParams.id}; - let query = `/claim/api/Claims/regularizeClaim`; + let query = `Claims/regularizeClaim`; return this.$http.post(query, data).then(() => { this.card.reload(); this.vnApp.showSuccess(this.$translate.instant('Data saved!')); @@ -136,7 +136,7 @@ class Controller { if (response !== 'ACCEPT') return; let greugeTypeFreight = 7; - let query = `claim/api/Greuges/`; + let query = `Greuges/`; let data = { clientFk: this.claim.clientFk, description: `claim: ${this.claim.id}`, @@ -158,14 +158,14 @@ class Controller { } saveResponsibility(value) { - let query = `/api/Claims/${this.$stateParams.id}/updateClaimAction`; + let query = `Claims/${this.$stateParams.id}/updateClaimAction`; this.$http.post(query, {responsibility: value}).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); }); } saveMana(value) { - let query = `/api/Claims/${this.$stateParams.id}/updateClaimAction`; + let query = `Claims/${this.$stateParams.id}/updateClaimAction`; this.$http.post(query, {isChargedToMana: value}).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index e526680c3..f808f0b21 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -7,9 +7,7 @@ describe('claim', () => { let $httpBackend; let $state; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => { $httpBackend = _$httpBackend_; @@ -46,7 +44,7 @@ describe('claim', () => { describe('getClaimedSales()', () => { it('should make a query and set salesToClaim', () => { controller.claim.id = 1; - $httpBackend.expectGET(`/claim/api/ClaimBeginnings/1`).respond(200, 1); + $httpBackend.expectGET(`ClaimBeginnings/1`).respond(200, 1); controller.getClaimedSales(); $httpBackend.flush(); @@ -59,7 +57,7 @@ describe('claim', () => { spyOn(controller.$.model, 'refresh'); spyOn(controller.$.addSales, 'hide'); spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expectPOST(`claim/api/ClaimEnds/`).respond({}); + $httpBackend.expectPOST(`ClaimEnds/`).respond({}); controller.addClaimedSale(1); $httpBackend.flush(); @@ -73,7 +71,7 @@ describe('claim', () => { it('should make a delete and call refresh and showSuccess', () => { spyOn(controller.$.model, 'refresh'); spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expectDELETE(`claim/api/ClaimEnds/1`).respond({}); + $httpBackend.expectDELETE(`ClaimEnds/1`).respond({}); controller.deleteClaimedSale(1); $httpBackend.flush(); @@ -99,7 +97,7 @@ describe('claim', () => { it('should perform a post query and add lines from a new ticket', () => { spyOn(controller.$.model, 'refresh'); spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expect('POST', `claim/api/ClaimBeginnings/1/importToNewRefundTicket`).respond({}); + $httpBackend.expect('POST', `ClaimBeginnings/1/importToNewRefundTicket`).respond({}); controller.importToNewRefundTicket(); $httpBackend.flush(); @@ -125,7 +123,7 @@ describe('claim', () => { spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.$.lastTicketsPopover, 'hide'); let data = {claimFk: 1, ticketFk: 1}; - $httpBackend.expect('POST', `/claim/api/ClaimEnds/importTicketSales`, data).respond({}); + $httpBackend.expect('POST', `ClaimEnds/importTicketSales`, data).respond({}); controller.importTicketLines(1); $httpBackend.flush(); @@ -141,7 +139,7 @@ describe('claim', () => { spyOn(controller.vnApp, 'showSuccess'); let data = {claimFk: $state.params.id}; - $httpBackend.expect('POST', `/claim/api/Claims/regularizeClaim`, data).respond({}); + $httpBackend.expect('POST', `Claims/regularizeClaim`, data).respond({}); controller.regularize(); $httpBackend.flush(); @@ -175,7 +173,7 @@ describe('claim', () => { greugeTypeFk: 7, ticketFk: controller.claim.ticketFk }; - $httpBackend.expect('POST', `claim/api/Greuges/`, data).respond(); + $httpBackend.expect('POST', `Greuges/`, data).respond(); controller.onUpdateGreugeResponse('ACCEPT'); $httpBackend.flush(); diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 1c68f6673..cd8cade9f 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -2,7 +2,7 @@ vn-id="watcher" data="$ctrl.claim" form="form" - url="/api/Claims/{{$ctrl.$stateParams.id}}/updateClaim" + url="Claims/{{$ctrl.$stateParams.id}}/updateClaim" save="post">
@@ -26,7 +26,7 @@ vn-one disabled="false" ng-model="$ctrl.claim.workerFk" - url="/api/Clients/activeWorkersWithRole" + url="Clients/activeWorkersWithRole" show-field="nickname" search-function="{firstName: $search}" value-field="id" @@ -36,7 +36,7 @@ { let controller; let $scope; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); diff --git a/modules/claim/front/card/index.js b/modules/claim/front/card/index.js index df11f322f..7c0c348a9 100644 --- a/modules/claim/front/card/index.js +++ b/modules/claim/front/card/index.js @@ -61,7 +61,7 @@ class Controller { getCard() { let json = encodeURIComponent(JSON.stringify(this.filter)); - let query = `/claim/api/Claims/${this.$state.params.id}?filter=${json}`; + let query = `Claims/${this.$state.params.id}?filter=${json}`; this.$http.get(query).then(res => { if (res.data) this.claim = res.data; diff --git a/modules/claim/front/card/index.spec.js b/modules/claim/front/card/index.spec.js index 3ac4c7e32..dfd106e89 100644 --- a/modules/claim/front/card/index.spec.js +++ b/modules/claim/front/card/index.spec.js @@ -7,9 +7,7 @@ describe('Claim', () => { let $httpBackend; let $state; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => { $httpBackend = _$httpBackend_; @@ -21,7 +19,7 @@ describe('Claim', () => { describe('getCard()', () => { it(`should make a query and save the data in claim`, () => { let json = encodeURIComponent(JSON.stringify(controller.filter)); - $httpBackend.expectGET(`/claim/api/Claims/${controller.$state.params.id}?filter=${json}`).respond({id: 1}); + $httpBackend.expectGET(`Claims/${controller.$state.params.id}?filter=${json}`).respond({id: 1}); controller.getCard(); $httpBackend.flush(); diff --git a/modules/claim/front/descriptor/index.js b/modules/claim/front/descriptor/index.js index 8d6977ea6..ed6a44808 100644 --- a/modules/claim/front/descriptor/index.js +++ b/modules/claim/front/descriptor/index.js @@ -60,7 +60,7 @@ class Controller { } showPickupOrder() { - let url = `/api/report/rpt-claim-pickup-order?claimFk=${this.claim.id}`; + let url = `report/rpt-claim-pickup-order?claimFk=${this.claim.id}`; window.open(url); } @@ -70,7 +70,7 @@ class Controller { sendPickupOrder(response) { if (response === 'ACCEPT') { - this.$http.post(`/api/email/claim-pickup-order`, {claimFk: this.claim.id}).then( + this.$http.post(`email/claim-pickup-order`, {claimFk: this.claim.id}).then( () => this.vnApp.showMessage(this.$translate.instant('Notification sent!')) ); } @@ -82,7 +82,7 @@ class Controller { deleteClaim(response) { if (response === 'ACCEPT') { - this.$http.delete(`/claim/api/Claims/${this.claim.id}`).then(() => { + this.$http.delete(`Claims/${this.claim.id}`).then(() => { this.vnApp.showSuccess(this.$translate.instant('Claim deleted!')); this.$state.go('claim.index'); }); diff --git a/modules/claim/front/descriptor/index.spec.js b/modules/claim/front/descriptor/index.spec.js index c6446a15b..47a64299e 100644 --- a/modules/claim/front/descriptor/index.spec.js +++ b/modules/claim/front/descriptor/index.spec.js @@ -4,9 +4,7 @@ describe('Item Component vnClaimDescriptor', () => { let $httpBackend; let controller; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; @@ -16,7 +14,7 @@ describe('Item Component vnClaimDescriptor', () => { describe('showPickupOrder()', () => { it('should open a new window showing a pickup order PDF document', () => { - let expectedPath = '/api/report/rpt-claim-pickup-order?claimFk=2'; + let expectedPath = 'report/rpt-claim-pickup-order?claimFk=2'; spyOn(window, 'open'); controller.showPickupOrder(); @@ -40,8 +38,8 @@ describe('Item Component vnClaimDescriptor', () => { it('should make a query and call vnApp.showMessage() if the response is ACCEPT', () => { spyOn(controller.vnApp, 'showMessage'); - $httpBackend.when('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond(); - $httpBackend.expect('POST', `/api/email/claim-pickup-order`, {claimFk: 2}).respond(); + $httpBackend.when('POST', `email/claim-pickup-order`, {claimFk: 2}).respond(); + $httpBackend.expect('POST', `email/claim-pickup-order`, {claimFk: 2}).respond(); controller.sendPickupOrder('ACCEPT'); $httpBackend.flush(); @@ -68,8 +66,8 @@ describe('Item Component vnClaimDescriptor', () => { spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.$state, 'go'); - $httpBackend.when('DELETE', `/claim/api/Claims/2`).respond(200); - $httpBackend.expect('DELETE', `/claim/api/Claims/2`); + $httpBackend.when('DELETE', `Claims/2`).respond(200); + $httpBackend.expect('DELETE', `Claims/2`); controller.deleteClaim(response); $httpBackend.flush(); diff --git a/modules/claim/front/detail/index.html b/modules/claim/front/detail/index.html index ad59fadd9..c1d83371f 100644 --- a/modules/claim/front/detail/index.html +++ b/modules/claim/front/detail/index.html @@ -1,7 +1,7 @@ diff --git a/modules/claim/front/detail/index.js b/modules/claim/front/detail/index.js index 1c2cb9e97..6589354ae 100644 --- a/modules/claim/front/detail/index.js +++ b/modules/claim/front/detail/index.js @@ -53,7 +53,7 @@ class Controller { getClaimableFromTicket() { let config = {params: {ticketFk: this.claim.ticketFk}}; - let query = `/api/Sales/getClaimableFromTicket`; + let query = `Sales/getClaimableFromTicket`; this.$http.get(query, config).then(res => { if (res.data) this.salesToClaim = res.data; @@ -63,7 +63,7 @@ class Controller { addClaimedSale(index) { let sale = this.salesToClaim[index]; let saleToAdd = {saleFk: sale.saleFk, claimFk: this.claim.id, quantity: sale.quantity}; - let query = `claim/api/ClaimBeginnings/`; + let query = `ClaimBeginnings/`; this.$http.post(query, saleToAdd).then(() => { this.$.addSales.hide(); this.$.model.refresh(); @@ -76,7 +76,7 @@ class Controller { deleteClaimedSale(index) { let sale = this.salesClaimed[index]; - let query = `claim/api/ClaimBeginnings/${sale.id}`; + let query = `ClaimBeginnings/${sale.id}`; this.$http.delete(query).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.$.model.remove(index); @@ -86,7 +86,7 @@ class Controller { setClaimedQuantity(id, claimedQuantity) { let params = {id: id, quantity: claimedQuantity}; - let query = `claim/api/ClaimBeginnings/`; + let query = `ClaimBeginnings/`; this.$http.patch(query, params).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); this.calculateTotals(); @@ -129,7 +129,7 @@ class Controller { } getManaSalespersonMana() { - this.$http.get(`/api/Tickets/${this.claim.ticketFk}/getSalesPersonMana`).then(res => { + this.$http.get(`Tickets/${this.claim.ticketFk}/getSalesPersonMana`).then(res => { this.mana = res.data; }); } @@ -137,7 +137,7 @@ class Controller { updateDiscount() { if (this.newDiscount != this.saleClaimed.sale.discount) { const params = {salesIds: [this.saleClaimed.sale.id], newDiscount: this.newDiscount}; - const query = `/api/Tickets/${this.saleClaimed.sale.ticketFk}/updateDiscount`; + const query = `Tickets/${this.saleClaimed.sale.ticketFk}/updateDiscount`; this.$http.post(query, params).then(() => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index bb3866b4c..a8843df38 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -9,9 +9,7 @@ describe('claim', () => { let $state; let aclService; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => { $scope = $rootScope.$new(); @@ -19,7 +17,7 @@ describe('claim', () => { show: () => {} }; $httpBackend = _$httpBackend_; - $httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({}); + $httpBackend.when('GET', 'Claims/ClaimBeginnings').respond({}); $state = _$state_; aclService = {hasAny: () => true}; controller = $componentController('vnClaimDetail', {$state, aclService, $scope}); @@ -47,7 +45,7 @@ describe('claim', () => { describe('getClaimableFromTicket()', () => { it('should make a query and set salesToClaim', () => { - $httpBackend.expectGET(`/api/Sales/getClaimableFromTicket?ticketFk=1`).respond(200, 1); + $httpBackend.expectGET(`Sales/getClaimableFromTicket?ticketFk=1`).respond(200, 1); controller.getClaimableFromTicket(); $httpBackend.flush(); @@ -59,7 +57,7 @@ describe('claim', () => { it('should make a post and call refresh, hide and showSuccess', () => { spyOn(controller.$.addSales, 'hide'); spyOn(controller.$state, 'go'); - $httpBackend.expectPOST(`claim/api/ClaimBeginnings/`).respond({}); + $httpBackend.expectPOST(`ClaimBeginnings/`).respond({}); controller.addClaimedSale(1); $httpBackend.flush(); @@ -71,7 +69,7 @@ describe('claim', () => { describe('deleteClaimedSale(index)', () => { it('should make a delete and call refresh and showSuccess', () => { spyOn(controller.$.model, 'remove'); - $httpBackend.expectDELETE(`claim/api/ClaimBeginnings/1`).respond({}); + $httpBackend.expectDELETE(`ClaimBeginnings/1`).respond({}); controller.deleteClaimedSale(0); $httpBackend.flush(); @@ -82,7 +80,7 @@ describe('claim', () => { describe('setClaimedQuantity(id, claimedQuantity)', () => { it('should make a patch and call refresh and showSuccess', () => { spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expectPATCH(`claim/api/ClaimBeginnings/`).respond({}); + $httpBackend.expectPATCH(`ClaimBeginnings/`).respond({}); controller.setClaimedQuantity(1, 1); $httpBackend.flush(); @@ -115,7 +113,7 @@ describe('claim', () => { spyOn(controller, 'clearDiscount'); spyOn(controller.$.model, 'refresh'); - $httpBackend.when('POST', '/api/Tickets/1/updateDiscount').respond({}); + $httpBackend.when('POST', 'Tickets/1/updateDiscount').respond({}); controller.updateDiscount(); $httpBackend.flush(); diff --git a/modules/claim/front/development/index.html b/modules/claim/front/development/index.html index 6c2441647..281eb0188 100644 --- a/modules/claim/front/development/index.html +++ b/modules/claim/front/development/index.html @@ -1,6 +1,6 @@ @@ -72,7 +72,7 @@ { let $scope; let aclService; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, $rootScope) => { $scope = $rootScope.$new(); diff --git a/modules/claim/front/dms/index/index.html b/modules/claim/front/dms/index/index.html index 6bed5c7da..b6c5ddf5e 100644 --- a/modules/claim/front/dms/index/index.html +++ b/modules/claim/front/dms/index/index.html @@ -1,5 +1,5 @@ @@ -16,7 +16,7 @@
+ zoom-image="dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
{ this.$.model.remove(this.dmsIndex); this.vnApp.showSuccess(this.$translate.instant('Photo deleted')); @@ -49,7 +49,7 @@ class Controller { const params = {filter: { where: {code: 'claim'} }}; - return this.$http.get('/api/DmsTypes/findOne', {params}).then(res => { + return this.$http.get('DmsTypes/findOne', {params}).then(res => { const dmsTypeId = res.data && res.data.id; const companyId = this.vnConfig.companyFk; const warehouseId = this.vnConfig.warehouseFk; @@ -71,7 +71,7 @@ class Controller { create() { - const query = `/api/claims/${this.claim.id}/uploadFile`; + const query = `claims/${this.claim.id}/uploadFile`; const options = { method: 'POST', url: query, diff --git a/modules/claim/front/dms/index/index.spec.js b/modules/claim/front/dms/index/index.spec.js index 738d7d109..a3d27c3f4 100644 --- a/modules/claim/front/dms/index/index.spec.js +++ b/modules/claim/front/dms/index/index.spec.js @@ -9,9 +9,7 @@ describe('Claim', () => { let controller; let $httpParamSerializer; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$httpParamSerializer_) => { $componentController = _$componentController_; @@ -35,8 +33,8 @@ describe('Claim', () => { controller.photos = [{dmsFk: 1}]; controller.dmsIndex = dmsIndex; - $httpBackend.when('POST', `/api/claimDms/${dmsId}/removeFile`).respond({}); - $httpBackend.expect('POST', `/api/claimDms/${dmsId}/removeFile`); + $httpBackend.when('POST', `claimDms/${dmsId}/removeFile`).respond({}); + $httpBackend.expect('POST', `claimDms/${dmsId}/removeFile`); controller.deleteDms('ACCEPT'); $httpBackend.flush(); @@ -51,8 +49,8 @@ describe('Claim', () => { where: {code: 'claim'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `/api/DmsTypes/findOne?${serializedParams}`).respond({}); - $httpBackend.expect('GET', `/api/DmsTypes/findOne?${serializedParams}`); + $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({}); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); controller.setDefaultParams(); $httpBackend.flush(); @@ -70,8 +68,8 @@ describe('Claim', () => { controller.dmsIndex = dmsIndex; controller.dms = {files: []}; - $httpBackend.when('POST', `/api/claims/${claimId}/uploadFile`).respond({}); - $httpBackend.expect('POST', `/api/claims/${claimId}/uploadFile`); + $httpBackend.when('POST', `claims/${claimId}/uploadFile`).respond({}); + $httpBackend.expect('POST', `claims/${claimId}/uploadFile`); controller.create(); $httpBackend.flush(); diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index f9f42348f..ef7ea04b6 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -1,6 +1,6 @@ {{description}} diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index a4c95abd7..c5d954057 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -1,5 +1,5 @@ @@ -87,7 +87,7 @@
+ zoom-image="dms/{{::photo.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js index 7d9e3716f..2cb99e705 100644 --- a/modules/claim/front/summary/index.js +++ b/modules/claim/front/summary/index.js @@ -30,7 +30,7 @@ class Controller { } getSummary() { - this.$http.get(`/claim/api/Claims/${this.claim.id}/getSummary`).then(response => { + this.$http.get(`Claims/${this.claim.id}/getSummary`).then(response => { this.summary = response.data; }); } diff --git a/modules/claim/front/summary/index.spec.js b/modules/claim/front/summary/index.spec.js index 87b3caac0..858829a68 100644 --- a/modules/claim/front/summary/index.spec.js +++ b/modules/claim/front/summary/index.spec.js @@ -6,9 +6,7 @@ describe('Claim', () => { let controller; let $httpBackend; - beforeEach(angular.mock.module('claim', $translateProvider => { - $translateProvider.translations('en', {}); - })); + beforeEach(ngModule('claim')); beforeEach(angular.mock.inject(($componentController, _$httpBackend_) => { $httpBackend = _$httpBackend_; @@ -19,8 +17,8 @@ describe('Claim', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { - $httpBackend.when('GET', `/claim/api/Claims/1/getSummary`).respond(200, 24); - $httpBackend.expect('GET', `/claim/api/Claims/1/getSummary`); + $httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24); + $httpBackend.expect('GET', `Claims/1/getSummary`); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/client/front/address/create/index.html b/modules/client/front/address/create/index.html index 30e49590c..3b39f8c5d 100644 --- a/modules/client/front/address/create/index.html +++ b/modules/client/front/address/create/index.html @@ -1,6 +1,6 @@ @@ -55,7 +55,7 @@