2019-11-22 09:42:05 +00:00
|
|
|
const app = require('vn-loopback/server/server');
|
|
|
|
|
2019-11-25 08:17:24 +00:00
|
|
|
describe('WorkerDms removeFile()', () => {
|
2019-11-22 13:34:20 +00:00
|
|
|
const workerDmsFk = 1;
|
2019-11-22 09:42:05 +00:00
|
|
|
it(`should return an error for a user without enough privileges`, async() => {
|
|
|
|
let clientId = 101;
|
|
|
|
let ctx = {req: {accessToken: {userId: clientId}}};
|
|
|
|
|
|
|
|
let error;
|
2019-11-22 13:34:20 +00:00
|
|
|
await app.models.WorkerDms.removeFile(ctx, workerDmsFk).catch(e => {
|
2019-11-22 09:42:05 +00:00
|
|
|
error = e;
|
|
|
|
}).finally(() => {
|
|
|
|
expect(error.message).toEqual(`You don't have enough privileges`);
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(error).toBeDefined();
|
|
|
|
});
|
|
|
|
});
|