From 1ec3777f4ad34069fde3035c3c3bbaa5c814b9a9 Mon Sep 17 00:00:00 2001 From: Bernat Date: Mon, 30 Jul 2018 15:21:12 +0200 Subject: [PATCH] update fixtures and fix test --- .../install/changes/1.0.10/02-foreginKey.sql | 7 + services/db/install/dump/fixtures.sql | 120 +++++++++++------- .../methods/client/specs/getMana.spec.js | 2 +- .../methods/ticket/specs/get-shipped.spec.js | 2 +- 4 files changed, 83 insertions(+), 48 deletions(-) diff --git a/services/db/install/changes/1.0.10/02-foreginKey.sql b/services/db/install/changes/1.0.10/02-foreginKey.sql index 0b89737e6..e64e1e942 100644 --- a/services/db/install/changes/1.0.10/02-foreginKey.sql +++ b/services/db/install/changes/1.0.10/02-foreginKey.sql @@ -2,3 +2,10 @@ ALTER TABLE `vn2008`.`cl_det` DROP FOREIGN KEY `cl_det_ibfk_6`; ALTER TABLE `vn2008`.`cl_det` DROP INDEX `cl_pet_id` ; + + + +ALTER TABLE `vn2008`.`cl_det` +DROP FOREIGN KEY `cl_det_ibfk_5`; +ALTER TABLE `vn2008`.`cl_det` +DROP INDEX `cl_que_id` ; diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 9ab3abf94..834e5ac28 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -67,12 +67,14 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`) INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`) VALUES - (1, 'inhouse pickup', 1, 0, 8, 1), - (2, 'Super-Man delivery', 1, 0, 8, 1), - (3, 'Teleportation device', 1, 0, 8, 1), - (4, 'Entanglement', 1, 0, 8, 1), - (5, 'Quantum break device', 1, 0, 8, 1), - (6, 'Walking', 1, 0, 8, 1); + (1, 'inhouse pickup' , 1, 0, 8, 1), + (2, 'Super-Man delivery' , 1, 0, 8, 1), + (3, 'Teleportation device' , 1, 0, 8, 1), + (4, 'Entanglement' , 1, 0, 8, 1), + (5, 'Quantum break device' , 1, 0, 8, 1), + (6, 'Walking' , 1, 0, 8, 1), + (7, 'Silla247' , 1, 0, 8, 1), + (8, 'Silla247Expensive' , 1, 0, 8, 1); UPDATE `vn`.`agencyMode` SET `id` = 1 WHERE `name` = 'inhouse pickup'; UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery'; @@ -80,6 +82,8 @@ UPDATE `vn`.`agencyMode` SET `id` = 3 WHERE `name` = 'Teleportation device'; UPDATE `vn`.`agencyMode` SET `id` = 4 WHERE `name` = 'Entanglement'; UPDATE `vn`.`agencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device'; UPDATE `vn`.`agencyMode` SET `id` = 6 WHERE `name` = 'Walking'; +UPDATE `vn`.`agencyMode` SET `id` = 7 WHERE `name` = 'Silla247'; +UPDATE `vn`.`agencyMode` SET `id` = 8 WHERE `name` = 'Silla247Expensive'; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 1; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 2; @@ -87,6 +91,8 @@ UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 2 WHERE `id` = 3; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 4; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 5; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 2 WHERE `id` = 6; +UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 7; +UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 8; UPDATE `vn`.`agencyMode` SET `web` = 1 WHERE `id` = 1; @@ -119,16 +125,30 @@ INSERT INTO `vn`.`province`(`id`, `name`, `countryFk`, `warehouseFk`, `zoneFk`) INSERT INTO `vn`.`agencyHour`(`id`, `agencyFk`, `weekDay`, `warehouseFk`, `provinceFk`, `maxHour`) VALUES - ( 1, 1, 0, 1, 1, 13), - ( 2, 1, 1, 1, 1, 14), - ( 3, 1, 2, 1, 1, 15), - ( 4, 1, 3, 1, 1, 16), - ( 5, 1, 4, 1, 1, 17), - ( 6, 2, 0, 1, 1, 13), - ( 7, 2, 1, 1, 1, 14), - ( 8, 2, 2, 1, 1, 15), - ( 9, 2, 3, 1, 1, 16), - ( 10, 2, 4, 1, 1, 17); + ( 1 , 1, 0, 1, 1, 13), + ( 2 , 1, 1, 1, 1, 14), + ( 3 , 1, 2, 1, 1, 15), + ( 4 , 1, 3, 1, 1, 16), + ( 5 , 1, 4, 1, 1, 17), + ( 6 , 2, 0, 1, 1, 13), + ( 7 , 2, 1, 1, 1, 14), + ( 8 , 2, 2, 1, 1, 15), + ( 9 , 2, 3, 1, 1, 16), + ( 10, 2, 4, 1, 1, 17), + ( 11, 7, 0, 1, 1, 22), + ( 12, 7, 1, 1, 1, 22), + ( 13, 7, 2, 1, 1, 22), + ( 14, 7, 3, 1, 1, 22), + ( 15, 7, 4, 1, 1, 22), + ( 16, 7, 5, 1, 1, 22), + ( 17, 7, 6, 1, 1, 22), + ( 18, 8, 0, 1, 1, 22), + ( 19, 8, 1, 1, 1, 22), + ( 20, 8, 2, 1, 1, 22), + ( 21, 8, 3, 1, 1, 22), + ( 22, 8, 4, 1, 1, 22), + ( 23, 8, 5, 1, 1, 22), + ( 24, 8, 6, 1, 1, 22); INSERT INTO `vn`.`clientType`(`id`, `code`, `type`) VALUES @@ -298,29 +318,29 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `issued`,`clientF ( 4, 'E4444444' , 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1), ( 5, 'E5555555' , 'E', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1); - INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `clientFk`,`nickname`, `addressFk`, `refFk`) + INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`) VALUES - (1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 101, 'Batman', 121, NULL), - (2, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY), 101, 'Spider-Man', 121, NULL), - (3, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY), 102, 'Super-Man', 122, NULL), - (4, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY), 102, 'Iron-Man', 122, NULL), - (5, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY), 103, 'Magneto', 123, NULL), - (6, 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY), 103, 'Legion', 123, NULL), - (7, 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY), 104, 'Ant-Man', 124, NULL), - (8, 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 'Professor X', 124, NULL), - (9, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'Hulk', 125, NULL), - (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'Jessica Jones', 125, NULL), - (11, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +10 DAY), 101, 'ticket 1', 121, NULL), - (12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'ticket 2', 121, NULL), - (13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'ticket 3', 121, NULL), - (14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'ticket 4', 121, NULL), - (15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'ticket 5', 121, NULL), - (16, 3, 3, 4, CURDATE(), 101, 'ticket 6', 121, NULL), - (17, 4, 4, 4, CURDATE(), 106, 'ticket 7', 126, NULL), - (18, 4, 4, 4, CURDATE(), 107, 'ticket 8', 127, NULL), - (19, 5, 5, 4, CURDATE(), 108, 'ticket 9', 128, NULL), - (20, 5, 5, 4, CURDATE(), 109, 'ticket 10', 119, NULL), - (21, 5, 5, 4, CURDATE(), 110, 'ticket 11', 129, NULL); + (1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'Batman', 121, NULL), + (2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'Spider-Man', 121, NULL), + (3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'Super-Man', 122, NULL), + (4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'Iron-Man', 122, NULL), + (5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'Magneto', 123, NULL), + (6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'Legion', 123, NULL), + (7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'Ant-Man', 124, NULL), + (8 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 'Professor X', 124, NULL), + (9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'Hulk', 125, NULL), + (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'Jessica Jones', 125, NULL), + (11, 1, 1, 1, CURDATE() , CURDATE() , 101, 'ticket 1', 121, NULL), + (12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'ticket 2', 121, NULL), + (13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'ticket 3', 121, NULL), + (14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'ticket 4', 121, NULL), + (15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'ticket 5', 121, NULL), + (16, 3, 3, 4, CURDATE() , CURDATE() , 101, 'ticket 6', 121, NULL), + (17, 4, 4, 4, CURDATE() , CURDATE() , 106, 'ticket 7', 126, NULL), + (18, 4, 4, 4, CURDATE() , CURDATE() , 107, 'ticket 8', 127, NULL), + (19, 5, 5, 4, CURDATE() , CURDATE() , 108, 'ticket 9', 128, NULL), + (20, 5, 5, 4, CURDATE() , CURDATE() , 109, 'ticket 10', 119, NULL), + (21, 5, 5, 4, CURDATE() , CURDATE() , 110, 'ticket 11', 129, NULL); INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES @@ -479,12 +499,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()); + ( 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, 1, 11, 'Gem of Mind', 15 , 4.5 , 0, 0, 0, CURDATE()), + ( 8, 1, 11, 'Mark I' , 10 , 9 , 0, 0, 0, CURDATE()); INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) VALUES @@ -500,7 +522,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) ( 1, 21, 5), ( 1, 23, 6.5), ( 1, 28, 1), - ( 2, 28, 1) , + ( 2, 28, 1), ( 3, 10, 1), ( 3, 14, 2.5), ( 3, 15, 3), @@ -526,7 +548,13 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) ( 6, 17, 4.5), ( 6, 21, 5), ( 6, 23, 6.5), - ( 6, 28, 1); + ( 6, 28, 1), + ( 7, 28, 1), + ( 7, 17, 3.5), + ( 8, 28, 1), + ( 8, 10, 1), + ( 8, 39, 5), + ( 8, 37, 2); INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`) VALUES diff --git a/services/loopback/common/methods/client/specs/getMana.spec.js b/services/loopback/common/methods/client/specs/getMana.spec.js index c14621380..8a4896a6a 100644 --- a/services/loopback/common/methods/client/specs/getMana.spec.js +++ b/services/loopback/common/methods/client/specs/getMana.spec.js @@ -4,7 +4,7 @@ describe('client getMana()', () => { it('should call the getMana method', done => { app.models.Client.getMana(101) .then(response => { - expect(response.mana).toEqual(190); + expect(response.mana).toEqual(260); done(); }); }); diff --git a/services/loopback/common/methods/ticket/specs/get-shipped.spec.js b/services/loopback/common/methods/ticket/specs/get-shipped.spec.js index 699337df5..edee09174 100644 --- a/services/loopback/common/methods/ticket/specs/get-shipped.spec.js +++ b/services/loopback/common/methods/ticket/specs/get-shipped.spec.js @@ -5,7 +5,7 @@ describe('ticket getShipped()', () => { let data = { landed: new Date(), addressFk: 121, - agencyModeFk: 2 + agencyModeFk: 7 }; app.models.Ticket.getShipped(data) .then(response => {