salix/modules/ticket/back/methods/expedition/specs/moveExpeditions.spec.js

37 lines
990 B
JavaScript
Raw Normal View History

2022-10-10 10:56:03 +00:00
const models = require('vn-loopback/server/server').models;
describe('ticket moveExpeditions()', () => {
2024-06-14 06:39:57 +00:00
const ctx = beforeAll.getCtx();
2022-10-20 06:41:00 +00:00
it('should move the selected expeditions to new ticket', async() => {
2022-10-10 10:56:03 +00:00
const tx = await models.Expedition.beginTransaction({});
const myCtx = ctx;
2022-10-10 10:56:03 +00:00
try {
const options = {transaction: tx};
2022-10-20 06:41:00 +00:00
myCtx.args = {
clientId: 1101,
2023-01-16 14:18:24 +00:00
landed: Date.vnNew(),
2022-10-20 06:41:00 +00:00
warehouseId: 1,
addressId: 121,
agencyModeId: 1,
routeId: null,
expeditionIds: [1, 2]
2022-10-10 10:56:03 +00:00
2022-10-20 06:41:00 +00:00
};
2022-10-10 10:56:03 +00:00
const ticket = await models.Expedition.moveExpeditions(ctx, options);
2022-10-20 06:41:00 +00:00
const newestTicketIdInFixtures = 27;
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
2022-10-10 10:56:03 +00:00
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});