update fixtures and fix test

This commit is contained in:
Bernat 2018-07-30 15:21:12 +02:00
parent 564d4f63b8
commit 1ec3777f4a
4 changed files with 83 additions and 48 deletions

View File

@ -2,3 +2,10 @@ ALTER TABLE `vn2008`.`cl_det`
DROP FOREIGN KEY `cl_det_ibfk_6`; DROP FOREIGN KEY `cl_det_ibfk_6`;
ALTER TABLE `vn2008`.`cl_det` ALTER TABLE `vn2008`.`cl_det`
DROP INDEX `cl_pet_id` ; 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` ;

View File

@ -67,12 +67,14 @@ INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`)
INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`) INSERT INTO `vn`.`agency`(`id`, `name`, `warehouseFk`, `isVolumetric`, `bankFk`, `warehouseAliasFk`)
VALUES VALUES
(1, 'inhouse pickup', 1, 0, 8, 1), (1, 'inhouse pickup' , 1, 0, 8, 1),
(2, 'Super-Man delivery', 1, 0, 8, 1), (2, 'Super-Man delivery' , 1, 0, 8, 1),
(3, 'Teleportation device', 1, 0, 8, 1), (3, 'Teleportation device' , 1, 0, 8, 1),
(4, 'Entanglement', 1, 0, 8, 1), (4, 'Entanglement' , 1, 0, 8, 1),
(5, 'Quantum break device', 1, 0, 8, 1), (5, 'Quantum break device' , 1, 0, 8, 1),
(6, 'Walking', 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` = 1 WHERE `name` = 'inhouse pickup';
UPDATE `vn`.`agencyMode` SET `id` = 2 WHERE `name` = 'Super-Man delivery'; 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` = 4 WHERE `name` = 'Entanglement';
UPDATE `vn`.`agencyMode` SET `id` = 5 WHERE `name` = 'Quantum break device'; 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` = 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` = 1;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 2; 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` = 4;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 5; UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 1 WHERE `id` = 5;
UPDATE `vn`.`agencyMode` SET `deliveryMethodFk` = 2 WHERE `id` = 6; 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; 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`) INSERT INTO `vn`.`agencyHour`(`id`, `agencyFk`, `weekDay`, `warehouseFk`, `provinceFk`, `maxHour`)
VALUES VALUES
( 1, 1, 0, 1, 1, 13), ( 1 , 1, 0, 1, 1, 13),
( 2, 1, 1, 1, 1, 14), ( 2 , 1, 1, 1, 1, 14),
( 3, 1, 2, 1, 1, 15), ( 3 , 1, 2, 1, 1, 15),
( 4, 1, 3, 1, 1, 16), ( 4 , 1, 3, 1, 1, 16),
( 5, 1, 4, 1, 1, 17), ( 5 , 1, 4, 1, 1, 17),
( 6, 2, 0, 1, 1, 13), ( 6 , 2, 0, 1, 1, 13),
( 7, 2, 1, 1, 1, 14), ( 7 , 2, 1, 1, 1, 14),
( 8, 2, 2, 1, 1, 15), ( 8 , 2, 2, 1, 1, 15),
( 9, 2, 3, 1, 1, 16), ( 9 , 2, 3, 1, 1, 16),
( 10, 2, 4, 1, 1, 17); ( 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`) INSERT INTO `vn`.`clientType`(`id`, `code`, `type`)
VALUES 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), ( 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); ( 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 VALUES
(1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY), 101, 'Batman', 121, 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), 101, 'Spider-Man', 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), 102, 'Super-Man', 122, 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), 102, 'Iron-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), 103, 'Magneto', 123, 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), 103, 'Legion', 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), 104, 'Ant-Man', 124, 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), 104, 'Professor X', 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), 105, 'Hulk', 125, 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), 105, 'Jessica Jones', 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, DATE_ADD(CURDATE(), INTERVAL +10 DAY), 101, 'ticket 1', 121, NULL), (11, 1, 1, 1, CURDATE() , CURDATE() , 101, 'ticket 1', 121, NULL),
(12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'ticket 2', 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), 101, 'ticket 3', 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), 101, 'ticket 4', 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), 101, 'ticket 5', 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(), 101, 'ticket 6', 121, NULL), (16, 3, 3, 4, CURDATE() , CURDATE() , 101, 'ticket 6', 121, NULL),
(17, 4, 4, 4, CURDATE(), 106, 'ticket 7', 126, NULL), (17, 4, 4, 4, CURDATE() , CURDATE() , 106, 'ticket 7', 126, NULL),
(18, 4, 4, 4, CURDATE(), 107, 'ticket 8', 127, NULL), (18, 4, 4, 4, CURDATE() , CURDATE() , 107, 'ticket 8', 127, NULL),
(19, 5, 5, 4, CURDATE(), 108, 'ticket 9', 128, NULL), (19, 5, 5, 4, CURDATE() , CURDATE() , 108, 'ticket 9', 128, NULL),
(20, 5, 5, 4, CURDATE(), 109, 'ticket 10', 119, NULL), (20, 5, 5, 4, CURDATE() , CURDATE() , 109, 'ticket 10', 119, NULL),
(21, 5, 5, 4, CURDATE(), 110, 'ticket 11', 129, NULL); (21, 5, 5, 4, CURDATE() , CURDATE() , 110, 'ticket 11', 129, NULL);
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
VALUES 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`) 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 , 23.5, 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.5 , 0, 0, 0, CURDATE()),
( 3, 1, 1, 'Gem of Time', 2 , 23.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()), ( 4, 4, 1 , 'Mark I' , 20 , 9 , 0, 0, 0, CURDATE()),
( 5, 1, 2, 'Gem of Time', 10 , 23.5, 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()); ( 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`) INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES VALUES
@ -500,7 +522,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
( 1, 21, 5), ( 1, 21, 5),
( 1, 23, 6.5), ( 1, 23, 6.5),
( 1, 28, 1), ( 1, 28, 1),
( 2, 28, 1) , ( 2, 28, 1),
( 3, 10, 1), ( 3, 10, 1),
( 3, 14, 2.5), ( 3, 14, 2.5),
( 3, 15, 3), ( 3, 15, 3),
@ -526,7 +548,13 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
( 6, 17, 4.5), ( 6, 17, 4.5),
( 6, 21, 5), ( 6, 21, 5),
( 6, 23, 6.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`) INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
VALUES VALUES

View File

@ -4,7 +4,7 @@ describe('client getMana()', () => {
it('should call the getMana method', done => { it('should call the getMana method', done => {
app.models.Client.getMana(101) app.models.Client.getMana(101)
.then(response => { .then(response => {
expect(response.mana).toEqual(190); expect(response.mana).toEqual(260);
done(); done();
}); });
}); });

View File

@ -5,7 +5,7 @@ describe('ticket getShipped()', () => {
let data = { let data = {
landed: new Date(), landed: new Date(),
addressFk: 121, addressFk: 121,
agencyModeFk: 2 agencyModeFk: 7
}; };
app.models.Ticket.getShipped(data) app.models.Ticket.getShipped(data)
.then(response => { .then(response => {