salix/back/models/specs/vn-user.spec.js

16 lines
489 B
JavaScript

const models = require('vn-loopback/server/server').models;
describe('loopback model VnUser', () => {
it('should return true if the user has the given role', async() => {
let result = await models.VnUser.hasRole(1, 'employee');
expect(result).toBeTruthy();
});
it('should return false if the user doesnt have the given role', async() => {
let result = await models.VnUser.hasRole(1, 'administrator');
expect(result).toBeFalsy();
});
});