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