salix/modules/ticket/back/methods/ticket-dms/specs/removeFile.spec.js

26 lines
746 B
JavaScript

const models = require('vn-loopback/server/server').models;
describe('TicketDms removeFile()', () => {
const ticketDmsId = 1;
it(`should return an error for a user without enough privileges`, async() => {
const tx = await models.TicketDms.beginTransaction({});
let error;
try {
const options = {transaction: tx};
const clientId = 1101;
const ctx = {req: {accessToken: {userId: clientId}}};
await models.TicketDms.removeFile(ctx, ticketDmsId, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
error = e;
}
expect(error.message).toEqual(`You don't have enough privileges`);
});
});