From bbb221cc0cc46bc2c0ee5d39576407839fde3de1 Mon Sep 17 00:00:00 2001 From: Bernat Date: Wed, 3 Oct 2018 08:12:34 +0200 Subject: [PATCH] update fixtures orders and fix test --- services/db/install/dump/fixtures.sql | 26 ++++++++++++++++--- .../methods/order/specs/catalogFilter.spec.js | 4 +-- .../methods/order/specs/isEditable.spec.js | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index e39a6e0e2..8c47f0d6e 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -813,10 +813,28 @@ INSERT INTO `vn`.`deliveryMethod`(`id`, `code`, `description`) INSERT INTO `hedera`.`order`(`id`, `date_send`, `customer_id`, `delivery_method_id`, `agency_id`, `address_id`, `company_id`, `note`, `source_app`, `confirmed`, `date_make`, `first_row_stamp`, `confirm_date`) VALUES - ( 1, CURDATE(), 101, 1, 1, 121, 442, NULL, 'TPV' , 0, CURDATE(), CURDATE() , CURDATE()), - ( 2, CURDATE(), 102, 2, 2, 122, 442, NULL, 'WEB' , 1, CURDATE(), CURDATE() , CURDATE()), - ( 3, CURDATE(), 103, 3, 7, 123, 442, NULL, 'ANDROID', 0, CURDATE(), DATE_ADD(CURDATE(), INTERVAL +5 DAY), DATE_ADD(CURDATE(),INTERVAL +5 DAY)); - + (1 , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 1, 1, 121, 442, NULL, 'TPV', 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), + (2 , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 2, 1, 121, 442, NULL, 'WEB', 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), + (3 , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 3, 2, 122, 442, NULL, 'ANDROID', 1, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), + (4 , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 1, 2, 122, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), + (5 , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 2, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), + (6 , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 3, 3, 123, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), + (7 , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 1, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), + (8 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 2, 4, 124, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (9 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 3, 5, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (10, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 1, 6, 125, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (11, CURDATE() , 101, 2, 7, 121, 442, NULL, 'SALIX', 1, CURDATE() , CURDATE() , CURDATE() ), + (12, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 3, 1, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (13, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 1, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH), DATE_ADD(CURDATE(), INTERVAL +2 MONTH)), + (14, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 2, 2, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH), DATE_ADD(CURDATE(), INTERVAL +3 MONTH)), + (15, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 3, 3, 121, 442, NULL, 'SALIX', 1, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH), DATE_ADD(CURDATE(), INTERVAL +4 MONTH)), + (16, CURDATE() , 101, 1, 1, 121, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (17, CURDATE() , 106, 2, 4, 126, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (18, CURDATE() , 107, 3, 4, 127, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (19, CURDATE() , 108, 1, 5, 128, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (20, CURDATE() , 109, 2, 5, 119, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ), + (21, CURDATE() , 110, 3, 5, 129, 442, NULL, 'SALIX', 0, CURDATE() , CURDATE() , CURDATE() ); + INSERT INTO `hedera`.`orderRow`(`id`, `orderFk`, `itemFk`, `warehouseFk`, `shipment`, `amount`, `price`, `rate`, `created`, `saleFk`) VALUES ( 1, 1, 1, 1 , NULL , 9, 1.5 , 1, CURDATE(), 1), diff --git a/services/order/common/methods/order/specs/catalogFilter.spec.js b/services/order/common/methods/order/specs/catalogFilter.spec.js index c30d743d1..508b3c5f8 100644 --- a/services/order/common/methods/order/specs/catalogFilter.spec.js +++ b/services/order/common/methods/order/specs/catalogFilter.spec.js @@ -5,7 +5,7 @@ describe('order catalogFilter()', () => { order: 'relevancy DESC, name' }; let args = { - orderFk: 3, + orderFk: 11, categoryFk: 1, typeFk: 2 }; @@ -23,7 +23,7 @@ describe('order catalogFilter()', () => { order: 'relevancy DESC, name' }; let args = { - orderFk: 3, + orderFk: 11, categoryFk: 1, typeFk: 2 }; diff --git a/services/order/common/methods/order/specs/isEditable.spec.js b/services/order/common/methods/order/specs/isEditable.spec.js index 99d8d98f1..5707802a6 100644 --- a/services/order/common/methods/order/specs/isEditable.spec.js +++ b/services/order/common/methods/order/specs/isEditable.spec.js @@ -14,7 +14,7 @@ describe('order isEditable()', () => { }); it('should return true when the given order is editable', async() => { - let isEditable = await app.models.Order.isEditable(1); + let isEditable = await app.models.Order.isEditable(16); expect(isEditable).toBeTruthy(); });