const models = require('vn-loopback/server/server').models; describe('Client hasCustomerRole', () => { it('should call the hasCustomerRole() method with a customer id', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const id = 1101; const result = await models.Client.hasCustomerRole(id, options); expect(result).toBeTruthy(); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); it('should call the hasCustomerRole() method with a non customer id', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const id = 8; const result = await models.Client.hasCustomerRole(id, options); expect(result).toBeFalsy(); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); it('should call the hasCustomerRole() method with an unreal id', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const id = 999; const result = await models.Client.hasCustomerRole(id, options); expect(result).toBeFalsy(); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); it('should call the hasCustomerRole() method with an invalid id', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const id = 'WRONG!'; const result = await models.Client.hasCustomerRole(id, options); expect(result).toBeFalsy(); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); });