update fixtures table sale, saleComponent and fix test

This commit is contained in:
Bernat 2018-09-04 14:52:38 +02:00
parent 21903c6414
commit ba51c0cc97
7 changed files with 42 additions and 16 deletions

View File

@ -510,14 +510,18 @@ 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 , 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());
( 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()),
( 9, 1, 16, 'Gem of Time', 5 , 9.60, 0, 0, 0, CURDATE()),
( 10, 2, 16, 'Gem of Mind', 10 , 4.21, 0, 0, 0, CURDATE()),
( 11, 1, 16, 'Gem of Time', 2 , 9.60, 0, 0, 0, CURDATE()),
( 12, 4, 16, 'Mark I' , 20 , 7.06, 0, 0, 0, CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
@ -567,7 +571,27 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
( 8, 10, 1),
( 8, 39, 5),
( 8, 15, 5),
( 8, 37, 2);
( 8, 37, 2),
( 9, 10, 1),
( 9, 14, 2.5),
( 9, 15, 3),
( 9, 17, 4.5),
( 9, 21, 5),
( 9, 23, 6.5),
( 9, 28, 1),
( 10, 28, 1),
( 11, 10, 1),
( 11, 14, 2.5),
( 11, 15, 3),
( 11, 17, 4.5),
( 11, 21, 5),
( 11, 23, 6.5),
( 11, 28, 1),
( 12, 28, 1),
( 12, 10, 1),
( 10, 17, 3.5),
( 12, 39, 5),
( 12, 37, 2);
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
VALUES

View File

@ -29,6 +29,8 @@
"The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
"The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero",
"Sample type cannot be blank": "Sample type cannot be blank",
"The new quantity should be smaller than the old one": "La nueva cantidad debe ser menor que la anterior",
"The package cannot be blank": "The package cannot be blank",
"The warehouse can't be repeated": "The warehouse can't be repeated"
"The warehouse can't be repeated": "The warehouse can't be repeated",
"The sales of that ticket can't be modified": "The sales of that ticket can't be modified"
}

View File

@ -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(1051.57);
expect(result.debt).toEqual(1342.66);
});
});

View File

@ -4,7 +4,7 @@ describe('client getMana()', () => {
it('should call the getMana method', async() => {
let result = await app.models.Client.getMana(101);
expect(result.mana).toEqual(260);
expect(result.mana).toEqual(400);
});
});

View File

@ -11,13 +11,13 @@ describe('client summary()', () => {
it('should return a summary object containing mana', async() => {
let result = await app.models.Client.summary(101);
expect(result.mana.mana).toEqual(260);
expect(result.mana.mana).toEqual(400);
});
it('should return a summary object containing debt', async() => {
let result = await app.models.Client.summary(101);
expect(result.debt.debt).toEqual(1051.57);
expect(result.debt.debt).toEqual(1342.66);
});
it('should return a summary object containing averageInvoiced', async() => {

View File

@ -4,7 +4,7 @@ describe('ticket getSalesPersonMana()', () => {
it('should get the mana of a salesperson of a given ticket', async() => {
let mana = await app.models.Ticket.getSalesPersonMana(1);
expect(mana).toEqual(330);
expect(mana).toEqual(470);
});
it('should return 0 if the given ticket does not exists', async() => {

View File

@ -4,7 +4,7 @@ describe('workerMana getCurrentWorkerMana()', () => {
it('should get the mana of the logged worker', async() => {
let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 18}}});
expect(mana).toEqual(330);
expect(mana).toEqual(470);
});
it('should return 0 if the user doesnt uses mana', async() => {