update fixtures table sale and fix test

This commit is contained in:
Bernat 2018-09-04 14:10:59 +02:00
parent b311524f11
commit 21903c6414
9 changed files with 21 additions and 21 deletions

View File

@ -53,9 +53,9 @@ describe('Ticket', () => {
.then(value => { .then(value => {
expect(value).toContain('Yellow'); expect(value).toContain('Yellow');
expect(value).toContain('5'); expect(value).toContain('5');
expect(value).toContain('€23.50'); expect(value).toContain('€9.60');
expect(value).toContain('0 %'); expect(value).toContain('0 %');
expect(value).toContain('€117.50'); expect(value).toContain('€48.00');
}); });
}); });
@ -65,9 +65,9 @@ describe('Ticket', () => {
.getInnerText(selectors.ticketSales.secondSaleText) .getInnerText(selectors.ticketSales.secondSaleText)
.then(value => { .then(value => {
expect(value).toContain('Red'); expect(value).toContain('Red');
expect(value).toContain('€4.50'); expect(value).toContain('€4.21');
expect(value).toContain('0 %'); expect(value).toContain('0 %');
expect(value).toContain('€45.00'); expect(value).toContain('€42.10');
}); });
}); });
}); });

View File

@ -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`) INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `price`, `discount`, `reserved`, `isPicked`, `created`)
VALUES VALUES
( 1, 1, 1 , 'Gem of Time', 5 , 23.5, 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.5 , 0, 0, 0, CURDATE()), ( 2, 2, 1 , 'Gem of Mind', 10 , 4.21, 0, 0, 0, CURDATE()),
( 3, 1, 1 , 'Gem of Time', 2 , 23.5, 0, 0, 0, CURDATE()), ( 3, 1, 1 , 'Gem of Time', 2 , 9.60, 0, 0, 0, CURDATE()),
( 4, 4, 1 , 'Mark I' , 20 , 9 , 0, 0, 0, CURDATE()), ( 4, 4, 1 , 'Mark I' , 20 , 7.06, 0, 0, 0, CURDATE()),
( 5, 1, 2 , 'Gem of Time', 10 , 23.5, 0, 0, 0, CURDATE()), ( 5, 1, 2 , 'Gem of Time', 10 , 9.60, 0, 0, 0, CURDATE()),
( 6, 1, 3 , 'Gem of Time', 15 , 23.5, 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.5 , 0, 0, 0, CURDATE()), ( 7, 2, 11, 'Gem of Mind', 15 , 4.21, 0, 0, 0, CURDATE()),
( 8, 4, 11, 'Mark I' , 10 , 9 , 0, 0, 0, CURDATE()); ( 8, 4, 11, 'Mark I' , 10 , 7.06, 0, 0, 0, CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES VALUES

View File

@ -4,7 +4,7 @@ describe('client getDebt()', () => {
it('should return the client debt', async() => { it('should return the client debt', async() => {
let result = await app.models.Client.getDebt(101); let result = await app.models.Client.getDebt(101);
expect(result.debt).toEqual(1389.9); expect(result.debt).toEqual(1051.57);
}); });
}); });

View File

@ -17,7 +17,7 @@ describe('client summary()', () => {
it('should return a summary object containing debt', async() => { it('should return a summary object containing debt', async() => {
let result = await app.models.Client.summary(101); 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() => { it('should return a summary object containing averageInvoiced', async() => {

View File

@ -10,8 +10,8 @@ describe('sale priceDifference()', () => {
}; };
let result = await app.models.Sale.priceDifference(1, data); 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.totalNewPrice).toEqual(26.12);
expect(result.totalDifference).toEqual(202.80); expect(result.totalDifference).toEqual(63.8);
}); });
}); });

View File

@ -4,6 +4,6 @@ describe('ticket getTaxes()', () => {
it('should return the tax of a given ticket', async() => { it('should return the tax of a given ticket', async() => {
let result = await app.models.Ticket.getTaxes(1); let result = await app.models.Ticket.getTaxes(1);
expect(result[0].tax).toEqual(20.95); expect(result[0].tax).toEqual(10.93);
}); });
}); });

View File

@ -4,7 +4,7 @@ describe('ticket getTotal()', () => {
it('should return the total of a ticket', async() => { it('should return the total of a ticket', async() => {
let result = await app.models.Ticket.getTotal(1); 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() => { it(`should return zero if the ticket doesn't have lines`, async() => {

View File

@ -4,7 +4,7 @@ describe('ticket getVAT()', () => {
it('should call the getVAT method and return the response', async() => { it('should call the getVAT method and return the response', async() => {
await app.models.Ticket.getVAT(1) await app.models.Ticket.getVAT(1)
.then(response => { .then(response => {
expect(response).toEqual(58.75); expect(response).toEqual(40.58);
}); });
}); });

View File

@ -17,13 +17,13 @@ describe('ticket summary()', () => {
it('should return a summary object containing subTotal for 1 ticket', async() => { it('should return a summary object containing subTotal for 1 ticket', async() => {
let result = await app.models.Ticket.summary(1); 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() => { it('should return a summary object containing VAT for 1 ticket', async() => {
let result = await app.models.Ticket.summary(1); 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() => { it('should return a summary object containing total for 1 ticket', async() => {