2022-09-26 06:21:58 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
2018-08-07 10:17:34 +00:00
|
|
|
|
2023-01-23 14:24:00 +00:00
|
|
|
describe('loopback model VnUser', () => {
|
2018-08-07 10:17:34 +00:00
|
|
|
it('should return true if the user has the given role', async() => {
|
2023-01-23 14:24:00 +00:00
|
|
|
let result = await models.VnUser.hasRole(1, 'employee');
|
2018-08-07 10:17:34 +00:00
|
|
|
|
|
|
|
expect(result).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return false if the user doesnt have the given role', async() => {
|
2023-01-23 14:24:00 +00:00
|
|
|
let result = await models.VnUser.hasRole(1, 'administrator');
|
2018-08-07 10:17:34 +00:00
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|