3888-ticket.expedition_moveExpedition #1097
|
@ -1,17 +1,33 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('ticket moveExpeditions()', () => {
|
||||
it('should delete the selected expeditions', async() => {
|
||||
it('should move the selected expeditions to new ticket', async() => {
|
||||
const tx = await models.Expedition.beginTransaction({});
|
||||
const ctx = {
|
||||
req: {accessToken: {userId: 9}},
|
||||
args: {},
|
||||
params: {}
|
||||
};
|
||||
const myCtx = Object.assign({}, ctx);
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
myCtx.args = {
|
||||
clientId: 1101,
|
||||
landed: new Date(),
|
||||
warehouseId: 1,
|
||||
addressId: 121,
|
||||
agencyModeId: 1,
|
||||
routeId: null,
|
||||
expeditionIds: [1, 2]
|
||||
|
||||
const expeditionIds = [12, 13];
|
||||
const ticketId = 1;
|
||||
const result = await models.Expedition.moveExpeditions(expeditionIds, ticketId, options);
|
||||
};
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
const ticket = await models.Expedition.moveExpeditions(myCtx, options);
|
||||
|
||||
const newestTicketIdInFixtures = 27;
|
||||
|
||||
expect(ticket.id).toBeGreaterThan(newestTicketIdInFixtures);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue