salix/services/loopback/common/methods/ticket/specs/componentUpdate.spec.js

21 lines
703 B
JavaScript

const app = require(`${servicesDir}/ticket/server/server`);
describe('ticket componentUpdate()', () => {
it('should call the componentUpdate method and receive an error', async() => {
let data = {
agencyModeFk: 1,
addressFk: 121,
warehouseFk: 1,
shipped: Date.now(),
landed: Date.now(),
hasToBeUnrouted: true,
option: 1
};
let ctx = {req: {accessToken: {userId: 101}}};
await app.models.Ticket.componentUpdate(1, data, ctx)
.catch(response => {
expect(response).toEqual(new Error('ER_SIGNAL_EXCEPTION: NO_AGENCY_AVAILABLE'));
});
});
});