updated sql
gitea/salix/1915-claim_regularize_fk This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-12-20 10:40:12 +01:00
parent 61408bdfd5
commit b9415c0335
3 changed files with 13 additions and 10 deletions

View File

@ -3,4 +3,4 @@ CREATE TABLE `vn`.`greugeConfig` (
`freightPickUpPrice` DECIMAL(10,2) NOT NULL, `freightPickUpPrice` DECIMAL(10,2) NOT NULL,
PRIMARY KEY (`id`)); PRIMARY KEY (`id`));
INSERT INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');

View File

@ -1979,3 +1979,4 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week
VALUES VALUES
(1, 43200, 129600, 734400, 43200, 50400); (1, 43200, 129600, 734400, 43200, 50400);
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');

View File

@ -153,6 +153,8 @@ describe('claim', () => {
}); });
describe('onUpdateGreugeResponse()', () => { describe('onUpdateGreugeResponse()', () => {
const greugeTypeId = 7;
const freightPickUpPrice = 11;
it('should do nothing', () => { it('should do nothing', () => {
spyOn(controller.$http, 'post'); spyOn(controller.$http, 'post');
spyOn(controller.card, 'reload'); spyOn(controller.card, 'reload');
@ -170,13 +172,13 @@ describe('claim', () => {
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
const greugeTypeParams = $httpParamSerializer({filter: {where: {code: 'freightPickUp'}}}); const greugeTypeParams = $httpParamSerializer({filter: {where: {code: 'freightPickUp'}}});
$httpBackend.expect('GET', `GreugeTypes/findOne?${greugeTypeParams}`).respond({id: 7}); $httpBackend.expect('GET', `GreugeTypes/findOne?${greugeTypeParams}`).respond({id: greugeTypeId});
$httpBackend.expect('GET', `GreugeConfigs/findOne`).respond({freightPickUpPrice: 11}); $httpBackend.expect('GET', `GreugeConfigs/findOne`).respond({freightPickUpPrice});
controller.onUpdateGreugeResponse('accept'); controller.onUpdateGreugeResponse('accept');
$httpBackend.flush(); $httpBackend.flush();
expect(controller.greugeTypeFreightId).toEqual(7); expect(controller.greugeTypeFreightId).toEqual(greugeTypeId);
expect(controller.freightPickUpPrice).toEqual(11); expect(controller.freightPickUpPrice).toEqual(freightPickUpPrice);
}); });
// #1957 - Investigate how to test nested httpBackend requests // #1957 - Investigate how to test nested httpBackend requests
@ -185,10 +187,10 @@ describe('claim', () => {
spyOn(controller.vnApp, 'showSuccess'); spyOn(controller.vnApp, 'showSuccess');
spyOn(controller, 'getGreugeTypeId').and.returnValue(new Promise(resolve => { spyOn(controller, 'getGreugeTypeId').and.returnValue(new Promise(resolve => {
return resolve({id: 7}); return resolve({id: greugeTypeId});
})); }));
spyOn(controller, 'getGreugeConfig').and.returnValue(new Promise(resolve => { spyOn(controller, 'getGreugeConfig').and.returnValue(new Promise(resolve => {
return resolve({freightPickUpPrice: 11}); return resolve({freightPickUpPrice});
})); }));
controller.claim.clientFk = 101; controller.claim.clientFk = 101;
@ -196,12 +198,12 @@ describe('claim', () => {
let data = { let data = {
clientFk: 101, clientFk: 101,
description: `claim: ${controller.claim.id}`, description: `claim: ${controller.claim.id}`,
amount: 11, amount: freightPickUpPrice,
greugeTypeFk: 7, greugeTypeFk: greugeTypeId,
ticketFk: controller.claim.ticketFk ticketFk: controller.claim.ticketFk
}; };
$httpBackend.expect('POST', `Greuges/`, data).respond(new Promise(resolve => { $httpBackend.expect('POST', `Greuges/`, data).respond(new Promise(resolve => {
return resolve({id: 11}); return resolve({id: freightPickUpPrice});
})); }));
controller.onUpdateGreugeResponse('accept').then(res => { controller.onUpdateGreugeResponse('accept').then(res => {
console.log('asdas'); console.log('asdas');