7642_createNewState #2736
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE vn.ticketLastState MODIFY COLUMN name varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
|
|
|
@ -1,3 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO vn.state ( name, `order`, alertLevel, code, sectorProdPriority, nextStateFk, isPreviousPreparable, isPicked, isPreparable, semaphore, isPrintable, isOK, graphCategory, isNotValidated, classColor) VALUES('Entregado en parte', 13, 3, 'PARTIAL_DELIVERED', NULL, 16, 0, 1, 0, 0, 0, 0, 0, 0, NULL);
|
|
|
@ -27,17 +27,17 @@ describe('Ticket saveSign()', () => {
|
||||||
expect(error).toBeDefined();
|
expect(error).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
fit('should change state for ticket', async() => {
|
it('should change state for ticket', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.State.beginTransaction({});
|
||||||
const ticketWithPackedState = 7;
|
const ticketWithOkState = 7;
|
||||||
const ticketStateId = 16;
|
const ticketStateId = 16;
|
||||||
const ticketCode = 'PARTIAL_DELIVERED';
|
const ticketCode = 'PARTIAL_DELIVERED';
|
||||||
spyOn(models.Dms, 'uploadFile').and.returnValue([{id: 1}]);
|
spyOn(models.Dms, 'uploadFile').and.returnValue([{id: 1}]);
|
||||||
let ticketLastState;
|
let ticketTrackingAfter;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const tickets = [ticketWithPackedState];
|
const tickets = [ticketWithOkState];
|
||||||
|
|
||||||
const state = await models.State.findById(ticketStateId, null, options);
|
const state = await models.State.findById(ticketStateId, null, options);
|
||||||
await state.updateAttributes({
|
await state.updateAttributes({
|
||||||
|
@ -46,8 +46,8 @@ describe('Ticket saveSign()', () => {
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
await models.Ticket.saveSign(ctx, tickets, null, null, options);
|
await models.Ticket.saveSign(ctx, tickets, null, null, options);
|
||||||
ticketLastState = await models.TicketLastState.findOne({
|
ticketTrackingAfter = await models.TicketLastState.findOne({
|
||||||
where: {ticketFk: ticketWithPackedState}
|
where: {ticketFk: ticketWithOkState}
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -56,6 +56,6 @@ describe('Ticket saveSign()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(ticketLastState.name).toBe('PARTIAL_DELIVERED');
|
expect(ticketTrackingAfter.name).toBe('PARTIAL_DELIVERED');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue