salix/modules/ticket/back/methods/ticket-request/specs/deny.spec.js

23 lines
652 B
JavaScript
Raw Normal View History

const models = require('vn-loopback/server/server').models;
2019-07-25 07:55:09 +00:00
describe('ticket-request deny()', () => {
it('should return the dinied ticket request', async() => {
const tx = await models.TicketRequest.beginTransaction({});
2019-07-25 07:55:09 +00:00
try {
const options = {transaction: tx};
2019-07-25 07:55:09 +00:00
const ctx = {req: {accessToken: {userId: 9}}, args: {id: 4, observation: 'my observation'}};
2019-07-25 07:55:09 +00:00
const result = await models.TicketRequest.deny(ctx, options);
2019-07-25 07:55:09 +00:00
expect(result.id).toEqual(4);
2019-07-25 07:55:09 +00:00
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
2019-07-25 07:55:09 +00:00
});
});