38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
|
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;
|
||
|
}
|
||
|
});
|
||
|
});
|