const models = require('vn-loopback/server/server').models; describe('client hasActiveRecovery', () => { it(`should return false if the client doesn't owes`, async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const hasActiveRecovery = await models.Recovery.hasActiveRecovery(1101, options); expect(hasActiveRecovery).toBeFalsy(); await tx.rollback(); } catch (e) { await tx.rollback(); } }); it('should return true if the client owes', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const hasActiveRecovery = await models.Recovery.hasActiveRecovery(1102, options); expect(hasActiveRecovery).toBeTruthy(); await tx.rollback(); } catch (e) { await tx.rollback(); } }); });