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

26 lines
713 B
JavaScript
Raw Normal View History

2021-07-08 13:53:30 +00:00
const models = require('vn-loopback/server/server').models;
2019-05-01 16:49:39 +00:00
describe('ClientDms removeFile()', () => {
2019-05-01 16:49:39 +00:00
it(`should return an error for a user without enough privileges`, async() => {
2021-07-08 13:53:30 +00:00
const tx = await models.Client.beginTransaction({});
2019-05-01 16:49:39 +00:00
let error;
2021-07-08 13:53:30 +00:00
try {
const options = {transaction: tx};
const clientDmsFk = 3;
const clientId = 1101;
const ctx = {req: {accessToken: {userId: clientId}}};
await models.ClientDms.removeFile(ctx, clientDmsFk, options);
await tx.rollback();
} catch (e) {
await tx.rollback();
2019-05-01 16:49:39 +00:00
error = e;
2021-07-08 13:53:30 +00:00
}
2019-05-01 16:49:39 +00:00
expect(error).toBeDefined();
});
});