2018-12-21 11:50:28 +00:00
|
|
|
const app = require(`${serviceRoot}/server/server`);
|
2018-08-07 10:17:34 +00:00
|
|
|
|
|
|
|
describe('loopback model Account', () => {
|
|
|
|
it('should return true if the user has the given role', async() => {
|
|
|
|
let result = await app.models.Account.hasRole(1, 'employee');
|
|
|
|
|
|
|
|
expect(result).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return false if the user doesnt have the given role', async() => {
|
|
|
|
let result = await app.models.Account.hasRole(1, 'administrator');
|
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
});
|