feat: refs #6583 add tests
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
f965f7aa52
commit
b935878dd6
|
@ -167,4 +167,56 @@ describe('TicketFuture getTicketsAdvance()', () => {
|
|||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return the tickets with only destination', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const args = {
|
||||
dateFuture: today,
|
||||
dateToAdvance: today.setHours(23, 59, 59, 999),
|
||||
warehouseFk: 1,
|
||||
};
|
||||
ctx.args = args;
|
||||
|
||||
const allTickets = await models.Ticket.getTicketsAdvance(ctx, options);
|
||||
ctx.args.onlyWithDestination = true;
|
||||
const withDestinationTickets = await models.Ticket.getTicketsAdvance(ctx, options);
|
||||
|
||||
expect(allTickets.filter(ticket => ticket.id).length).toBe(withDestinationTickets.length);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
fit('should return the tickets without only destination', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const args = {
|
||||
dateFuture: today,
|
||||
dateToAdvance: today.setHours(23, 59, 59, 999),
|
||||
warehouseFk: 1,
|
||||
};
|
||||
ctx.args = args;
|
||||
|
||||
const allTickets = await models.Ticket.getTicketsAdvance(ctx, options);
|
||||
ctx.args.onlyWithDestination = false;
|
||||
const withoutDestinationTickets = await models.Ticket.getTicketsAdvance(ctx, options);
|
||||
|
||||
expect(allTickets.filter(ticket => !ticket.id).length).toBe(withoutDestinationTickets.length);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue