31 lines
922 B
JavaScript
31 lines
922 B
JavaScript
const app = require('vn-loopback/server/server');
|
|
|
|
/**
|
|
* Pendiente de fixtures dms, dmsType, ticketDms
|
|
* CAU: 10728
|
|
*/
|
|
xdescribe('dms download()', () => {
|
|
let dmsId = 1;
|
|
it('should return a response for an employee with text content-type', async() => {
|
|
let workerFk = 107;
|
|
let ctx = {req: {accessToken: {userId: workerFk}}};
|
|
const result = await app.models.Dms.download(ctx, dmsId);
|
|
|
|
expect(result[1]).toEqual('text/plain');
|
|
});
|
|
|
|
it(`should return an error for a user without enough privileges`, async() => {
|
|
let clientId = 101;
|
|
let ctx = {req: {accessToken: {userId: clientId}}};
|
|
|
|
let error;
|
|
await app.models.Dms.download(ctx, dmsId).catch(e => {
|
|
error = e;
|
|
}).finally(() => {
|
|
expect(error.message).toEqual(`You don't have enough privileges`);
|
|
});
|
|
|
|
expect(error).toBeDefined();
|
|
});
|
|
});
|