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

23 lines
710 B
JavaScript
Raw Normal View History

2019-07-15 09:40:11 +00:00
const app = require('vn-loopback/server/server');
describe('dms updateFile()', () => {
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let companyId = 442;
let warehouseId = 1;
let dmsTypeId = 14;
let dmsId = 1;
let ctx = {req: {accessToken: {userId: clientId}}, args: {dmsTypeId: dmsTypeId}};
let error;
await app.models.Dms.updateFile(ctx, dmsId, warehouseId, companyId, dmsTypeId).catch(e => {
error = e;
}).finally(() => {
expect(error.message).toEqual(`You don't have enough privileges`);
});
expect(error).toBeDefined();
});
});