From 6913f2db72b1f8146da92f6dda4a13b3ac6f5f95 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 23 Jul 2020 17:10:07 +0200 Subject: [PATCH] $httpBackend.when and .expect no longer misused --- modules/claim/front/action/index.spec.js | 4 ++-- modules/claim/front/detail/index.spec.js | 6 +++--- modules/claim/front/summary/index.spec.js | 3 +-- modules/client/front/address/index/index.spec.js | 3 +-- .../front/credit-insurance/index/index.spec.js | 3 +-- modules/client/front/dms/create/index.spec.js | 6 ++---- modules/client/front/dms/edit/index.spec.js | 4 +--- modules/client/front/fiscal-data/index.spec.js | 3 +-- modules/client/front/postcode/index.spec.js | 3 +-- modules/client/front/summary/index.spec.js | 3 +-- modules/client/front/web-access/index.spec.js | 6 ++---- modules/client/front/web-payment/index.spec.js | 3 +-- modules/invoiceOut/front/summary/index.spec.js | 1 - modules/item/front/summary/index.spec.js | 3 +-- modules/order/front/create/card.spec.js | 5 ++--- modules/route/front/summary/index.spec.js | 1 - modules/route/front/tickets/index.spec.js | 4 ++-- .../front/basic-data/step-one/index.spec.js | 15 +++++---------- modules/ticket/front/dms/create/index.spec.js | 6 ++---- modules/ticket/front/dms/edit/index.spec.js | 4 +--- modules/ticket/front/sale/index.spec.js | 12 ++++++------ modules/ticket/front/summary/index.spec.js | 1 - modules/ticket/front/weekly/index.spec.js | 4 ++-- .../travel/front/thermograph/create/index.spec.js | 6 ++---- .../travel/front/thermograph/edit/index.spec.js | 3 +-- modules/worker/front/dms/create/index.spec.js | 3 +-- modules/worker/front/dms/edit/index.spec.js | 4 +--- 27 files changed, 43 insertions(+), 76 deletions(-) diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index 4922e3789..34899537b 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -91,7 +91,7 @@ describe('claim', () => { $httpBackend.flush(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.lastTicketsPopover.hide).toHaveBeenCalledWith(); }); }); @@ -106,7 +106,7 @@ describe('claim', () => { $httpBackend.flush(); expect(controller.card.reload).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); diff --git a/modules/claim/front/detail/index.spec.js b/modules/claim/front/detail/index.spec.js index fea61dae8..972d487e5 100644 --- a/modules/claim/front/detail/index.spec.js +++ b/modules/claim/front/detail/index.spec.js @@ -80,7 +80,7 @@ describe('claim', () => { controller.deleteClaimedSale(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); @@ -91,7 +91,7 @@ describe('claim', () => { controller.setClaimedQuantity(1, 1); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); @@ -126,7 +126,7 @@ describe('claim', () => { expect(controller.calculateTotals).toHaveBeenCalledWith(); expect(controller.clearDiscount).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.editPopover.hide).toHaveBeenCalledWith(); }); }); diff --git a/modules/claim/front/summary/index.spec.js b/modules/claim/front/summary/index.spec.js index 7db59b79c..d6300b30a 100644 --- a/modules/claim/front/summary/index.spec.js +++ b/modules/claim/front/summary/index.spec.js @@ -20,8 +20,7 @@ describe('Claim', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { - $httpBackend.when('GET', `Claims/1/getSummary`).respond(200, 24); - $httpBackend.expect('GET', `Claims/1/getSummary`); + $httpBackend.expect('GET', `Claims/1/getSummary`).respond(200, 24); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js index 343f2bdb1..c7b4985c8 100644 --- a/modules/client/front/address/index/index.spec.js +++ b/modules/client/front/address/index/index.spec.js @@ -28,8 +28,7 @@ describe('Client', () => { let data = {defaultAddressFk: address.id}; let expectedResult = {defaultAddressFk: address.id}; - $httpBackend.when('PATCH', `Clients/1`, data).respond(200, expectedResult); - $httpBackend.expect('PATCH', `Clients/1`, data); + $httpBackend.expect('PATCH', `Clients/1`, data).respond(200, expectedResult); controller.setDefault(address); $httpBackend.flush(); diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js index d3e376c3d..8546297fc 100644 --- a/modules/client/front/credit-insurance/index/index.spec.js +++ b/modules/client/front/credit-insurance/index/index.spec.js @@ -77,8 +77,7 @@ describe('Client', () => { it('should call the returnDialog method and perform a PATCH query, then call _getClassifications method', () => { jest.spyOn(controller, '_getClassifications').mockReturnThis(); controller.classificationId = 1; - $httpBackend.when('PATCH', `CreditClassifications/1`).respond(200); - $httpBackend.expect('PATCH', `CreditClassifications/1`); + $httpBackend.expect('PATCH', `CreditClassifications/1`).respond(200); controller.returnDialog('accept'); $httpBackend.flush(); diff --git a/modules/client/front/dms/create/index.spec.js b/modules/client/front/dms/create/index.spec.js index 08e16a854..0ed3f6671 100644 --- a/modules/client/front/dms/create/index.spec.js +++ b/modules/client/front/dms/create/index.spec.js @@ -39,8 +39,7 @@ describe('Client', () => { where: {code: 'paymentsLaw'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'}); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 12, code: 'paymentsLaw'}); controller.setDefaultParams(); $httpBackend.flush(); @@ -63,8 +62,7 @@ describe('Client', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `clientDms/allowedContentTypes`); + $httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/client/front/dms/edit/index.spec.js b/modules/client/front/dms/edit/index.spec.js index 16189fdc6..e52ab7f7b 100644 --- a/modules/client/front/dms/edit/index.spec.js +++ b/modules/client/front/dms/edit/index.spec.js @@ -45,7 +45,6 @@ describe('Client', () => { hasFileAttached: false }; - $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse); $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); controller.setDefaultParams(); $httpBackend.flush(); @@ -70,8 +69,7 @@ describe('Client', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `clientDms/allowedContentTypes`); + $httpBackend.expect('GET', `clientDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js index 2b9f9a557..e028d01f3 100644 --- a/modules/client/front/fiscal-data/index.spec.js +++ b/modules/client/front/fiscal-data/index.spec.js @@ -126,8 +126,7 @@ describe('Client', () => { describe('onAcceptEt()', () => { it('should request to patch the propagation of tax status', () => { controller.client = {id: 123, isEqualizated: false}; - $httpBackend.when('PATCH', `Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); - $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}); + $httpBackend.expectPATCH(`Clients/${controller.client.id}/addressesPropagateRe`, {isEqualizated: controller.client.isEqualizated}).respond('done'); controller.onAcceptEt(); $httpBackend.flush(); }); diff --git a/modules/client/front/postcode/index.spec.js b/modules/client/front/postcode/index.spec.js index 8313d5d57..8778fd9b0 100644 --- a/modules/client/front/postcode/index.spec.js +++ b/modules/client/front/postcode/index.spec.js @@ -22,8 +22,7 @@ describe('Client', () => { controller.data = {townFk: 1, provinceFk: 1, countryFk: 1, code: '46460'}; jest.spyOn(controller.vnApp, 'showMessage'); - $httpBackend.when('PATCH', `postcodes`, params).respond(200, params); - $httpBackend.expect('PATCH', `postcodes`, params).respond(params); + $httpBackend.expect('PATCH', `postcodes`, params).respond(200, params); controller.onAccept(); $httpBackend.flush(); diff --git a/modules/client/front/summary/index.spec.js b/modules/client/front/summary/index.spec.js index 770567c84..05491267c 100644 --- a/modules/client/front/summary/index.spec.js +++ b/modules/client/front/summary/index.spec.js @@ -21,8 +21,7 @@ describe('Client', () => { let res = {name: 'Superman', classifications: []}; jest.spyOn(controller, 'sumRisk').mockReturnThis(); - $httpBackend.when('GET', `Clients/101/summary`).respond(200, res); - $httpBackend.expect('GET', `Clients/101/summary`); + $httpBackend.expect('GET', `Clients/101/summary`).respond(200, res); controller.$onChanges(); $httpBackend.flush(); diff --git a/modules/client/front/web-access/index.spec.js b/modules/client/front/web-access/index.spec.js index 5ff95f716..b1118eeba 100644 --- a/modules/client/front/web-access/index.spec.js +++ b/modules/client/front/web-access/index.spec.js @@ -57,8 +57,7 @@ describe('Component VnClientWebAccess', () => { expect(controller.canEnableCheckBox).toBeTruthy(); - $httpBackend.when('GET', `Clients/${controller.client.id}/isValidClient`).respond(false); - $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`); + $httpBackend.expectGET(`Clients/${controller.client.id}/isValidClient`).respond(false); controller.checkConditions(); $httpBackend.flush(); @@ -83,8 +82,7 @@ describe('Component VnClientWebAccess', () => { controller.newPassword = 'm24x8'; controller.repeatPassword = 'm24x8'; controller.canChangePassword = true; - $httpBackend.when('PATCH', 'Accounts/1234').respond('done'); - $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'}); + $httpBackend.expectPATCH('Accounts/1234', {password: 'm24x8'}).respond('done'); controller.onPassChange('accept'); $httpBackend.flush(); }); diff --git a/modules/client/front/web-payment/index.spec.js b/modules/client/front/web-payment/index.spec.js index 3fb8ec692..ee7d6c717 100644 --- a/modules/client/front/web-payment/index.spec.js +++ b/modules/client/front/web-payment/index.spec.js @@ -25,8 +25,7 @@ describe('Component vnClientWebPayment', () => { let query = 'Clients/confirmTransaction'; controller.confirm(transaction); - $httpBackend.when('POST', query, transaction).respond('ok'); - $httpBackend.expect('POST', query, transaction); + $httpBackend.expect('POST', query, transaction).respond('ok'); $httpBackend.flush(); }); }); diff --git a/modules/invoiceOut/front/summary/index.spec.js b/modules/invoiceOut/front/summary/index.spec.js index 885141d8c..fadf0ad89 100644 --- a/modules/invoiceOut/front/summary/index.spec.js +++ b/modules/invoiceOut/front/summary/index.spec.js @@ -19,7 +19,6 @@ describe('InvoiceOut', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { $httpBackend.when('GET', `InvoiceOuts/1/summary`).respond(200, 'the data you are looking for'); - $httpBackend.expect('GET', `InvoiceOuts/1/summary`); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/item/front/summary/index.spec.js b/modules/item/front/summary/index.spec.js index 90b896831..0b349194c 100644 --- a/modules/item/front/summary/index.spec.js +++ b/modules/item/front/summary/index.spec.js @@ -19,8 +19,7 @@ describe('Item', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { let data = {id: 1, name: 'Gem of mind'}; - $httpBackend.when('GET', `Items/1/getSummary`).respond(200, data); - $httpBackend.expect('GET', `Items/1/getSummary`); + $httpBackend.expect('GET', `Items/1/getSummary`).respond(200, data); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/order/front/create/card.spec.js b/modules/order/front/create/card.spec.js index 0a240358d..99e8c1f8a 100644 --- a/modules/order/front/create/card.spec.js +++ b/modules/order/front/create/card.spec.js @@ -91,12 +91,11 @@ describe('Order', () => { jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller.$state, 'go'); - $httpBackend.when('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}).respond(200, 1); - $httpBackend.expect('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}); + $httpBackend.expect('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}).respond(200, 1); controller.createOrder(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$state.go).toHaveBeenCalledWith('order.card.catalog', {id: 1}); }); }); diff --git a/modules/route/front/summary/index.spec.js b/modules/route/front/summary/index.spec.js index d199986a5..ad300817a 100644 --- a/modules/route/front/summary/index.spec.js +++ b/modules/route/front/summary/index.spec.js @@ -17,7 +17,6 @@ describe('Route', () => { describe('getSummary()', () => { it('should perform a query to set summary', () => { $httpBackend.when('GET', `Routes/1/summary`).respond(200, 24); - $httpBackend.expect('GET', `Routes/1/summary`); controller.getSummary(); $httpBackend.flush(); diff --git a/modules/route/front/tickets/index.spec.js b/modules/route/front/tickets/index.spec.js index 8537c3e88..2f4ad6cfd 100644 --- a/modules/route/front/tickets/index.spec.js +++ b/modules/route/front/tickets/index.spec.js @@ -101,7 +101,7 @@ describe('Route', () => { controller.setPriority(ticketId, priority); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); }); }); @@ -318,7 +318,7 @@ describe('Route', () => { controller.insert(ticketId); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); }); }); diff --git a/modules/ticket/front/basic-data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js index 7a360ff68..d9c72b660 100644 --- a/modules/ticket/front/basic-data/step-one/index.spec.js +++ b/modules/ticket/front/basic-data/step-one/index.spec.js @@ -251,8 +251,7 @@ describe('Ticket', () => { }; filter = encodeURIComponent(JSON.stringify(filter)); - $httpBackend.when('GET', `Clients/${clientId}/addresses?filter=${filter}`).respond(200); - $httpBackend.expect('GET', `Clients/${clientId}/addresses?filter=${filter}`); + $httpBackend.expect('GET', `Clients/${clientId}/addresses?filter=${filter}`).respond(200); controller.clientAddressesList(clientId); $httpBackend.flush(); }); @@ -262,8 +261,7 @@ describe('Ticket', () => { it('should return the default address from choosed client', async() => { const clientId = 102; - $httpBackend.when('GET', `Clients/${clientId}`).respond(200); - $httpBackend.expect('GET', `Clients/${clientId}`); + $httpBackend.expect('GET', `Clients/${clientId}`).respond(200); controller.getClientDefaultAddress(clientId); $httpBackend.flush(); }); @@ -273,8 +271,7 @@ describe('Ticket', () => { it('should return an available zone', async() => { const zoneId = 5; const agencyModeFk = 8; - $httpBackend.when('GET', `Zones/${zoneId}`).respond(200, {agencyModeFk}); - $httpBackend.expect('GET', `Zones/${zoneId}`); + $httpBackend.expect('GET', `Zones/${zoneId}`).respond(200, {agencyModeFk}); controller.onChangeZone(zoneId); $httpBackend.flush(); @@ -337,8 +334,7 @@ describe('Ticket', () => { }; const serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `Agencies/getLanded?${serializedParams}`).respond(200, expectedResult); - $httpBackend.expect('GET', `Agencies/getLanded?${serializedParams}`); + $httpBackend.expect('GET', `Agencies/getLanded?${serializedParams}`).respond(200, expectedResult); controller.getLanded(params); $httpBackend.flush(); @@ -359,8 +355,7 @@ describe('Ticket', () => { }; const serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `Agencies/getShipped?${serializedParams}`).respond(200, expectedResult); - $httpBackend.expect('GET', `Agencies/getShipped?${serializedParams}`); + $httpBackend.expect('GET', `Agencies/getShipped?${serializedParams}`).respond(200, expectedResult); controller.getShipped(params); $httpBackend.flush(); diff --git a/modules/ticket/front/dms/create/index.spec.js b/modules/ticket/front/dms/create/index.spec.js index 277ffc13b..e3c195799 100644 --- a/modules/ticket/front/dms/create/index.spec.js +++ b/modules/ticket/front/dms/create/index.spec.js @@ -44,8 +44,7 @@ describe('Ticket', () => { where: {code: 'ticket'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 14, code: 'ticket'}); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: 14, code: 'ticket'}); controller.setDefaultParams(); $httpBackend.flush(); @@ -68,8 +67,7 @@ describe('Ticket', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `ticketDms/allowedContentTypes`); + $httpBackend.expect('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/ticket/front/dms/edit/index.spec.js b/modules/ticket/front/dms/edit/index.spec.js index 1f58ea4a3..052b08a1b 100644 --- a/modules/ticket/front/dms/edit/index.spec.js +++ b/modules/ticket/front/dms/edit/index.spec.js @@ -45,7 +45,6 @@ describe('Ticket', () => { hasFileAttached: false }; - $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse); $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); controller.setDefaultParams(); $httpBackend.flush(); @@ -70,8 +69,7 @@ describe('Ticket', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `ticketDms/allowedContentTypes`); + $httpBackend.expect('GET', `ticketDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 63c9db2f4..28b3ce3dd 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -248,7 +248,7 @@ describe('Ticket', () => { $httpBackend.flush(); expect(controller.card.reload).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -267,7 +267,7 @@ describe('Ticket', () => { $httpBackend.flush(); expect(controller.removeSelectedSales).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -371,7 +371,7 @@ describe('Ticket', () => { expect(selectedSale.price).toEqual(2); expect(controller.refreshTotal).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.editPricePopover.hide).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); @@ -472,7 +472,7 @@ describe('Ticket', () => { expect(firstSelectedSale.discount).toEqual(expectedDiscount); expect(secondSelectedSale.discount).toEqual(expectedDiscount); expect(controller.refreshTotal).toHaveBeenCalledWith(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); }); @@ -678,7 +678,7 @@ describe('Ticket', () => { controller.addSale(newSale); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.refreshTotal).toHaveBeenCalledWith(); expect(controller.resetChanges).toHaveBeenCalledWith(); }); @@ -719,7 +719,7 @@ describe('Ticket', () => { controller.calculateSalePrice(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.refresh).toHaveBeenCalledWith(); expect(controller.refreshTotal).toHaveBeenCalledWith(); }); diff --git a/modules/ticket/front/summary/index.spec.js b/modules/ticket/front/summary/index.spec.js index e61a4afda..e94f316de 100644 --- a/modules/ticket/front/summary/index.spec.js +++ b/modules/ticket/front/summary/index.spec.js @@ -18,7 +18,6 @@ describe('Ticket', () => { it('should perform a GET query and define the summary property', () => { let res = {id: 1, nickname: 'Batman'}; $httpBackend.when('GET', `Tickets/1/summary`).respond(200, res); - $httpBackend.expect('GET', `Tickets/1/summary`); controller.ticket = {id: 1}; $httpBackend.flush(); diff --git a/modules/ticket/front/weekly/index.spec.js b/modules/ticket/front/weekly/index.spec.js index 811f45615..2af01db16 100644 --- a/modules/ticket/front/weekly/index.spec.js +++ b/modules/ticket/front/weekly/index.spec.js @@ -23,7 +23,7 @@ describe('ticket weekly', () => { controller.onUpdate('ticketFk', 'field', 'value'); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); }); }); @@ -38,7 +38,7 @@ describe('ticket weekly', () => { controller.onDeleteWeeklyAccept('ticketFk'); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalled(); expect(controller.$.model.remove).toHaveBeenCalledWith(0); }); }); diff --git a/modules/travel/front/thermograph/create/index.spec.js b/modules/travel/front/thermograph/create/index.spec.js index 3dac0875b..36f17a409 100644 --- a/modules/travel/front/thermograph/create/index.spec.js +++ b/modules/travel/front/thermograph/create/index.spec.js @@ -40,8 +40,7 @@ describe('Ticket', () => { where: {code: 'miscellaneous'} }}; let serializedParams = $httpParamSerializer(params); - $httpBackend.when('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: dmsTypeId, code: 'miscellaneous'}); - $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`); + $httpBackend.expect('GET', `DmsTypes/findOne?${serializedParams}`).respond({id: dmsTypeId, code: 'miscellaneous'}); controller.setDefaultParams(); $httpBackend.flush(); @@ -54,8 +53,7 @@ describe('Ticket', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['application/pdf', 'image/png', 'image/jpg']; - $httpBackend.when('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`); + $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/travel/front/thermograph/edit/index.spec.js b/modules/travel/front/thermograph/edit/index.spec.js index cad98e663..68ce763c2 100644 --- a/modules/travel/front/thermograph/edit/index.spec.js +++ b/modules/travel/front/thermograph/edit/index.spec.js @@ -79,8 +79,7 @@ describe('Worker', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`); + $httpBackend.expect('GET', `TravelThermographs/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/worker/front/dms/create/index.spec.js b/modules/worker/front/dms/create/index.spec.js index 023fc7e55..f0d088715 100644 --- a/modules/worker/front/dms/create/index.spec.js +++ b/modules/worker/front/dms/create/index.spec.js @@ -64,8 +64,7 @@ describe('Client', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `workerDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `workerDms/allowedContentTypes`); + $httpBackend.expect('GET', `workerDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush(); diff --git a/modules/worker/front/dms/edit/index.spec.js b/modules/worker/front/dms/edit/index.spec.js index 36700d51e..3724a6c7c 100644 --- a/modules/worker/front/dms/edit/index.spec.js +++ b/modules/worker/front/dms/edit/index.spec.js @@ -46,7 +46,6 @@ describe('Worker', () => { hasFileAttached: false }; - $httpBackend.when('GET', `Dms/${dmsId}`).respond(expectedResponse); $httpBackend.expect('GET', `Dms/${dmsId}`).respond(expectedResponse); controller.setDefaultParams(); $httpBackend.flush(); @@ -71,8 +70,7 @@ describe('Worker', () => { describe('getAllowedContentTypes()', () => { it('should make an HTTP GET request to get the allowed content types', () => { const expectedResponse = ['image/png', 'image/jpg']; - $httpBackend.when('GET', `WorkerDms/allowedContentTypes`).respond(expectedResponse); - $httpBackend.expect('GET', `WorkerDms/allowedContentTypes`); + $httpBackend.expect('GET', `WorkerDms/allowedContentTypes`).respond(expectedResponse); controller.getAllowedContentTypes(); $httpBackend.flush();