const {models} = require('vn-loopback/server/server'); describe('ticketObservation addDropOff()', () => { const ticketFk = 5; const note = 'DropOff note'; const code = 'dropOff'; it('should return a dropOff note', async() => { const tx = await models.TicketObservation.beginTransaction({}); try { const options = {transaction: tx}; await models.TicketObservation.addDropOff( ticketFk, note, options); const observationTypeDropOff = await models.TicketObservation.find({ where: { ticketFk, code } }, options); expect(observationTypeDropOff.length).toEqual(1); await tx.rollback(); } catch (e) { await tx.rollback(); throw e; } }); });