test: hotFix saveSign
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-08-06 08:59:20 +02:00
parent 70a91da0ff
commit 6fb78e1599
1 changed files with 4 additions and 11 deletions

View File

@ -30,8 +30,6 @@ describe('Ticket saveSign()', () => {
it('should change state for ticket', async() => {
const tx = await models.Ticket.beginTransaction({});
const ticketWithPackedState = 7;
const ticketStateId = 16;
const ticketCode = 'PARTIAL_DELIVERED';
spyOn(models.Dms, 'uploadFile').and.returnValue([{id: 1}]);
let ticketTrackingAfter;
@ -39,16 +37,11 @@ describe('Ticket saveSign()', () => {
const options = {transaction: tx};
const tickets = [ticketWithPackedState];
const state = await models.State.findById(ticketStateId, null, options);
await state.updateAttributes({
code: ticketCode,
name: ticketCode
}, options);
const expedition = await models.Expedition.findById(3, null, options);
expedition.updateAttribute('ticketFk', ticketWithPackedState, options);
await models.Ticket.saveSign(ctx, tickets, null, null, options);
ticketTrackingAfter = await models.TicketLastState.findOne({
where: {ticketFk: ticketWithPackedState}
}, options);
ticketTrackingAfter = await models.TicketLastState.findById(ticketWithPackedState, null, options);
await tx.rollback();
} catch (e) {
@ -56,6 +49,6 @@ describe('Ticket saveSign()', () => {
throw e;
}
expect(ticketTrackingAfter.name).toBe('PARTIAL_DELIVERED');
expect(ticketTrackingAfter.name).toBe('Entregado en parte');
});
});