const {models} = require('vn-loopback'); describe('workerActivity insert()', () => { const ctx = beforeAll.getCtx(1106); it('should insert in workerActivity', async() => { const tx = await models.WorkerActivity.beginTransaction({}); let count = 0; const options = {transaction: tx}; try { await models.WorkerActivityType.create( {'code': 'TEST', 'description': 'TEST'}, options ); await models.WorkerActivity.add(ctx, 'TEST', 'APP', options); count = await models.WorkerActivity.count( {'workerFK': 1106}, options ); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } expect(count).toEqual(1); }); });