salix/back/methods/dms/specs/removeFile.spec.js

20 lines
557 B
JavaScript
Raw Normal View History

2023-01-24 08:04:43 +00:00
const {models} = require('vn-loopback/server/server');
2019-05-01 16:49:39 +00:00
describe('dms removeFile()', () => {
2019-05-01 16:49:39 +00:00
let dmsId = 1;
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 1101;
2019-05-01 16:49:39 +00:00
let ctx = {req: {accessToken: {userId: clientId}}};
let error;
2023-01-24 08:04:43 +00:00
await models.Dms.removeFile(ctx, dmsId).catch(e => {
2019-05-01 16:49:39 +00:00
error = e;
}).finally(() => {
expect(error.message).toEqual(`You don't have enough privileges`);
});
expect(error).toBeDefined();
});
});