From 21903c6414bf5f6c893169eb9a6c938f5cb3a10f Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 4 Sep 2018 14:10:59 +0200 Subject: [PATCH] update fixtures table sale and fix test --- e2e/paths/ticket-module/03_list_sale.spec.js | 8 ++++---- services/db/install/dump/fixtures.sql | 16 ++++++++-------- .../common/methods/client/specs/getDebt.spec.js | 2 +- .../common/methods/client/specs/summary.spec.js | 2 +- .../methods/sale/specs/priceDifference.spec.js | 4 ++-- .../common/methods/ticket/specs/getTaxes.spec.js | 2 +- .../common/methods/ticket/specs/getTotal.spec.js | 2 +- .../common/methods/ticket/specs/getVAT.spec.js | 2 +- .../common/methods/ticket/specs/summary.spec.js | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js index 884faaaf8..b76e9cc5a 100644 --- a/e2e/paths/ticket-module/03_list_sale.spec.js +++ b/e2e/paths/ticket-module/03_list_sale.spec.js @@ -53,9 +53,9 @@ describe('Ticket', () => { .then(value => { expect(value).toContain('Yellow'); expect(value).toContain('5'); - expect(value).toContain('€23.50'); + expect(value).toContain('€9.60'); expect(value).toContain('0 %'); - expect(value).toContain('€117.50'); + expect(value).toContain('€48.00'); }); }); @@ -65,9 +65,9 @@ describe('Ticket', () => { .getInnerText(selectors.ticketSales.secondSaleText) .then(value => { expect(value).toContain('Red'); - expect(value).toContain('€4.50'); + expect(value).toContain('€4.21'); expect(value).toContain('0 %'); - expect(value).toContain('€45.00'); + expect(value).toContain('€42.10'); }); }); }); diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index abc46115c..0e44501f0 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -510,14 +510,14 @@ INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`) VALUES - ( 1, 1, 1 , 'Gem of Time', 5 , 23.5, 0, 0, 0, CURDATE()), - ( 2, 2, 1 , 'Gem of Mind', 10 , 4.5 , 0, 0, 0, CURDATE()), - ( 3, 1, 1 , 'Gem of Time', 2 , 23.5, 0, 0, 0, CURDATE()), - ( 4, 4, 1 , 'Mark I' , 20 , 9 , 0, 0, 0, CURDATE()), - ( 5, 1, 2 , 'Gem of Time', 10 , 23.5, 0, 0, 0, CURDATE()), - ( 6, 1, 3 , 'Gem of Time', 15 , 23.5, 0, 0, 0, CURDATE()), - ( 7, 2, 11, 'Gem of Mind', 15 , 4.5 , 0, 0, 0, CURDATE()), - ( 8, 4, 11, 'Mark I' , 10 , 9 , 0, 0, 0, CURDATE()); + ( 1, 1, 1 , 'Gem of Time', 5 , 9.60, 0, 0, 0, CURDATE()), + ( 2, 2, 1 , 'Gem of Mind', 10 , 4.21, 0, 0, 0, CURDATE()), + ( 3, 1, 1 , 'Gem of Time', 2 , 9.60, 0, 0, 0, CURDATE()), + ( 4, 4, 1 , 'Mark I' , 20 , 7.06, 0, 0, 0, CURDATE()), + ( 5, 1, 2 , 'Gem of Time', 10 , 9.60, 0, 0, 0, CURDATE()), + ( 6, 1, 3 , 'Gem of Time', 15 , 9.60, 0, 0, 0, CURDATE()), + ( 7, 2, 11, 'Gem of Mind', 15 , 4.21, 0, 0, 0, CURDATE()), + ( 8, 4, 11, 'Mark I' , 10 , 7.06, 0, 0, 0, CURDATE()); INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) VALUES diff --git a/services/loopback/common/methods/client/specs/getDebt.spec.js b/services/loopback/common/methods/client/specs/getDebt.spec.js index dff62a9ff..1ad715798 100644 --- a/services/loopback/common/methods/client/specs/getDebt.spec.js +++ b/services/loopback/common/methods/client/specs/getDebt.spec.js @@ -4,7 +4,7 @@ describe('client getDebt()', () => { it('should return the client debt', async() => { let result = await app.models.Client.getDebt(101); - expect(result.debt).toEqual(1389.9); + expect(result.debt).toEqual(1051.57); }); }); diff --git a/services/loopback/common/methods/client/specs/summary.spec.js b/services/loopback/common/methods/client/specs/summary.spec.js index c70d56642..20abe2b03 100644 --- a/services/loopback/common/methods/client/specs/summary.spec.js +++ b/services/loopback/common/methods/client/specs/summary.spec.js @@ -17,7 +17,7 @@ describe('client summary()', () => { it('should return a summary object containing debt', async() => { let result = await app.models.Client.summary(101); - expect(result.debt.debt).toEqual(1389.9); + expect(result.debt.debt).toEqual(1051.57); }); it('should return a summary object containing averageInvoiced', async() => { diff --git a/services/loopback/common/methods/sale/specs/priceDifference.spec.js b/services/loopback/common/methods/sale/specs/priceDifference.spec.js index fc304cceb..0205cf098 100644 --- a/services/loopback/common/methods/sale/specs/priceDifference.spec.js +++ b/services/loopback/common/methods/sale/specs/priceDifference.spec.js @@ -10,8 +10,8 @@ describe('sale priceDifference()', () => { }; let result = await app.models.Sale.priceDifference(1, data); - expect(result.totalUnitPrice).toEqual(60.5); + expect(result.totalUnitPrice).toEqual(30.469999999999995); expect(result.totalNewPrice).toEqual(26.12); - expect(result.totalDifference).toEqual(202.80); + expect(result.totalDifference).toEqual(63.8); }); }); diff --git a/services/loopback/common/methods/ticket/specs/getTaxes.spec.js b/services/loopback/common/methods/ticket/specs/getTaxes.spec.js index 5bb6ecf46..d9637ab85 100644 --- a/services/loopback/common/methods/ticket/specs/getTaxes.spec.js +++ b/services/loopback/common/methods/ticket/specs/getTaxes.spec.js @@ -4,6 +4,6 @@ describe('ticket getTaxes()', () => { it('should return the tax of a given ticket', async() => { let result = await app.models.Ticket.getTaxes(1); - expect(result[0].tax).toEqual(20.95); + expect(result[0].tax).toEqual(10.93); }); }); diff --git a/services/loopback/common/methods/ticket/specs/getTotal.spec.js b/services/loopback/common/methods/ticket/specs/getTotal.spec.js index 062256df1..1d211fbba 100644 --- a/services/loopback/common/methods/ticket/specs/getTotal.spec.js +++ b/services/loopback/common/methods/ticket/specs/getTotal.spec.js @@ -4,7 +4,7 @@ describe('ticket getTotal()', () => { it('should return the total of a ticket', async() => { let result = await app.models.Ticket.getTotal(1); - expect(result).toEqual(448.25); + expect(result).toEqual(291.08); }); it(`should return zero if the ticket doesn't have lines`, async() => { diff --git a/services/loopback/common/methods/ticket/specs/getVAT.spec.js b/services/loopback/common/methods/ticket/specs/getVAT.spec.js index 13b6473c2..300744502 100644 --- a/services/loopback/common/methods/ticket/specs/getVAT.spec.js +++ b/services/loopback/common/methods/ticket/specs/getVAT.spec.js @@ -4,7 +4,7 @@ describe('ticket getVAT()', () => { it('should call the getVAT method and return the response', async() => { await app.models.Ticket.getVAT(1) .then(response => { - expect(response).toEqual(58.75); + expect(response).toEqual(40.58); }); }); diff --git a/services/loopback/common/methods/ticket/specs/summary.spec.js b/services/loopback/common/methods/ticket/specs/summary.spec.js index e1f2f18fb..96e0153be 100644 --- a/services/loopback/common/methods/ticket/specs/summary.spec.js +++ b/services/loopback/common/methods/ticket/specs/summary.spec.js @@ -17,13 +17,13 @@ describe('ticket summary()', () => { it('should return a summary object containing subTotal for 1 ticket', async() => { let result = await app.models.Ticket.summary(1); - expect(result.subTotal).toEqual(389.5); + expect(result.subTotal).toEqual(250.5); }); it('should return a summary object containing VAT for 1 ticket', async() => { let result = await app.models.Ticket.summary(1); - expect(result.VAT).toEqual(58.75); + expect(result.VAT).toEqual(40.58); }); it('should return a summary object containing total for 1 ticket', async() => {