From b9415c0335b5a556450e1c6d10649f288ee76dcd Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Fri, 20 Dec 2019 10:40:12 +0100 Subject: [PATCH] updated sql --- .../10130-christmas/00-greugeConfig.sql | 2 +- db/dump/fixtures.sql | 1 + modules/claim/front/action/index.spec.js | 20 ++++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/db/changes/10130-christmas/00-greugeConfig.sql b/db/changes/10130-christmas/00-greugeConfig.sql index f434c7fd7..c21751f08 100644 --- a/db/changes/10130-christmas/00-greugeConfig.sql +++ b/db/changes/10130-christmas/00-greugeConfig.sql @@ -3,4 +3,4 @@ CREATE TABLE `vn`.`greugeConfig` ( `freightPickUpPrice` DECIMAL(10,2) NOT NULL, PRIMARY KEY (`id`)); -INSERT INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); +INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 53bb9ff23..788f10e5b 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1979,3 +1979,4 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week VALUES (1, 43200, 129600, 734400, 43200, 50400); +INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index b93809750..0d10957e7 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -153,6 +153,8 @@ describe('claim', () => { }); describe('onUpdateGreugeResponse()', () => { + const greugeTypeId = 7; + const freightPickUpPrice = 11; it('should do nothing', () => { spyOn(controller.$http, 'post'); spyOn(controller.card, 'reload'); @@ -170,13 +172,13 @@ describe('claim', () => { spyOn(controller.vnApp, 'showSuccess'); const greugeTypeParams = $httpParamSerializer({filter: {where: {code: 'freightPickUp'}}}); - $httpBackend.expect('GET', `GreugeTypes/findOne?${greugeTypeParams}`).respond({id: 7}); - $httpBackend.expect('GET', `GreugeConfigs/findOne`).respond({freightPickUpPrice: 11}); + $httpBackend.expect('GET', `GreugeTypes/findOne?${greugeTypeParams}`).respond({id: greugeTypeId}); + $httpBackend.expect('GET', `GreugeConfigs/findOne`).respond({freightPickUpPrice}); controller.onUpdateGreugeResponse('accept'); $httpBackend.flush(); - expect(controller.greugeTypeFreightId).toEqual(7); - expect(controller.freightPickUpPrice).toEqual(11); + expect(controller.greugeTypeFreightId).toEqual(greugeTypeId); + expect(controller.freightPickUpPrice).toEqual(freightPickUpPrice); }); // #1957 - Investigate how to test nested httpBackend requests @@ -185,10 +187,10 @@ describe('claim', () => { spyOn(controller.vnApp, 'showSuccess'); spyOn(controller, 'getGreugeTypeId').and.returnValue(new Promise(resolve => { - return resolve({id: 7}); + return resolve({id: greugeTypeId}); })); spyOn(controller, 'getGreugeConfig').and.returnValue(new Promise(resolve => { - return resolve({freightPickUpPrice: 11}); + return resolve({freightPickUpPrice}); })); controller.claim.clientFk = 101; @@ -196,12 +198,12 @@ describe('claim', () => { let data = { clientFk: 101, description: `claim: ${controller.claim.id}`, - amount: 11, - greugeTypeFk: 7, + amount: freightPickUpPrice, + greugeTypeFk: greugeTypeId, ticketFk: controller.claim.ticketFk }; $httpBackend.expect('POST', `Greuges/`, data).respond(new Promise(resolve => { - return resolve({id: 11}); + return resolve({id: freightPickUpPrice}); })); controller.onUpdateGreugeResponse('accept').then(res => { console.log('asdas');