salix/modules/ticket/back/methods/ticket-observation/specs/addDropOff.spec.js

38 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-04-17 11:55:07 +00:00
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 myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await models.TicketObservation.beginTransaction({});
myOptions.transaction = tx;
}
try {
await models.TicketObservation.addDropOff(
ticketFk, note, myOptions);
const observationTypeDropOff = await models.TicketObservation.find({
where: {
ticketFk,
code
}
}, myOptions);
expect(observationTypeDropOff.length).toEqual(1);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});