const models = require('vn-loopback/server/server').models; describe('Client createWithInsurance', () => { it('should create a new client credit classification with insurance', async() => { const tx = await models.Client.beginTransaction({}); try { const options = {transaction: tx}; const data = {clientFk: 1101, started: Date.now(), credit: 999, grade: 255}; const result = await models.CreditClassification.createWithInsurance(data, options); expect(result.client).toEqual(1101); const classifications = await models.CreditClassification.find(); const insurances = await models.CreditInsurance.find(); expect(classifications.length).toEqual(6); expect(insurances.length).toEqual(4); await tx.rollback(); } catch (e) { await tx.rollback(); } }); });