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

26 lines
746 B
JavaScript
Raw Permalink Normal View History

const models = require('vn-loopback/server/server').models;
2019-05-01 16:49:39 +00:00
describe('TicketDms removeFile()', () => {
const ticketDmsId = 1;
2019-05-01 16:49:39 +00:00
it(`should return an error for a user without enough privileges`, async() => {
const tx = await models.TicketDms.beginTransaction({});
2019-05-01 16:49:39 +00:00
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();
2019-05-01 16:49:39 +00:00
error = e;
}
2019-05-01 16:49:39 +00:00
expect(error.message).toEqual(`You don't have enough privileges`);
2019-05-01 16:49:39 +00:00
});
});