feat: refs #6629 test back updateObservations
This commit is contained in:
parent
95e7757574
commit
849bcd1ff5
|
@ -157,4 +157,57 @@ describe('Address updateAddress', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fit('should update ticket observations when updateObservations is true', async() => {
|
||||||
|
const tx = await models.Client.beginTransaction({});
|
||||||
|
const client = 1103;
|
||||||
|
const address = 123;
|
||||||
|
const ticket = 31;
|
||||||
|
const observationType = 3;
|
||||||
|
|
||||||
|
const salesAssistantId = 21;
|
||||||
|
const addressObservation = 'nuevo texto';
|
||||||
|
const ticketObservation = 'texto a modificar';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = salesAssistantId;
|
||||||
|
ctx.args = {
|
||||||
|
updateObservations: true,
|
||||||
|
incotermsFk: incotermsId,
|
||||||
|
provinceFk: provinceId,
|
||||||
|
customsAgentFk: customAgentOneId
|
||||||
|
};
|
||||||
|
|
||||||
|
await models.AddressObservation.create({
|
||||||
|
addressFk: address,
|
||||||
|
observationTypeFk: observationType,
|
||||||
|
description: addressObservation
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
await models.TicketObservation.create({
|
||||||
|
ticketFk: ticket,
|
||||||
|
observationTypeFk: observationType,
|
||||||
|
description: ticketObservation
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
await models.Client.updateAddress(ctx, client, address, options);
|
||||||
|
|
||||||
|
const updatedObservation = await models.TicketObservation.findOne({
|
||||||
|
where: {ticketFk: ticket, observationTypeFk: observationType}
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
// const address = await models.Address.findById(addressId, null, options);
|
||||||
|
|
||||||
|
// const addressObservation = await models.addressObservation.findById(addressId, null, options);
|
||||||
|
|
||||||
|
expect(updatedObservation).toEqual(addressObservation);
|
||||||
|
// expect(1).toEqual(1);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue