feat: refs #8151 Requested changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-11-14 10:45:28 +01:00
parent d4a60f63c9
commit 534b50f51a
1 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('ticket moveExpeditions()', () => { fdescribe('ticket moveExpeditions()', () => {
const ctx = beforeAll.getCtx(); const ctx = beforeAll.getCtx();
it('should move the selected expeditions to new ticket', async() => { it('should move the selected expeditions to new ticket', async() => {
@ -17,14 +17,13 @@ describe('ticket moveExpeditions()', () => {
agencyModeId: 1, agencyModeId: 1,
routeId: null, routeId: null,
expeditionIds: [1, 2] expeditionIds: [1, 2]
}; };
const newestTicketIdInFixtures = await models.Ticket.findOne({
order: 'id DESC'
}, options);
const ticket = await models.Expedition.moveExpeditions(ctx, options); const ticket = await models.Expedition.moveExpeditions(ctx, options);
const newestTicketIdInFixtures = 27; expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures.id);
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
@ -49,11 +48,12 @@ describe('ticket moveExpeditions()', () => {
expeditionIds: [1, 2] expeditionIds: [1, 2]
}; };
const newestTicketIdInFixtures = await models.Ticket.findOne({
order: 'id DESC'
}, options);
const ticket = await models.Expedition.moveExpeditions(myCtx, options); const ticket = await models.Expedition.moveExpeditions(myCtx, options);
const newestTicketIdInFixtures = 27; expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures.id);
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
const updatedTicket = await models.Ticket.findById(ticket.id, null, options); const updatedTicket = await models.Ticket.findById(ticket.id, null, options);
const packedState = await models.State.findOne({where: {code: 'PACKED'}}, options); const packedState = await models.State.findOne({where: {code: 'PACKED'}}, options);