diff --git a/services/loopback/common/models/specs/account.spec.js b/services/loopback/common/models/specs/account.spec.js new file mode 100644 index 000000000..97abedd6e --- /dev/null +++ b/services/loopback/common/models/specs/account.spec.js @@ -0,0 +1,15 @@ +const app = require(`${servicesDir}/client/server/server`); + +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(); + }); +});