refs #3520 hasUncheckedTicket
This commit is contained in:
parent
eaf3749440
commit
39b1e9ff7b
|
@ -19,7 +19,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.getUncheckedTicket = async(ticketFk, options) => {
|
||||
Self.hasUncheckedTicket = async(ticketFk, options) => {
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('ticketCollection hasUncheckedTicket()', () => {
|
||||
fit('should return false because there are not tickets not checked', async() => {
|
||||
it('should return false because there are not tickets not checked', async() => {
|
||||
const ticketFk = 1;
|
||||
const result = await models.TicketCollection.hasUncheckedTicket(ticketFk);
|
||||
|
||||
|
@ -11,17 +11,19 @@ describe('ticketCollection hasUncheckedTicket()', () => {
|
|||
|
||||
it('should return true because there is a ticket not checked', async() => {
|
||||
const ticketFk = 1;
|
||||
const stateFkCurrent = 16;
|
||||
const stateFkUpdated = 7;
|
||||
|
||||
const tx = await models.TicketTracking.beginTransaction({});
|
||||
const myOptions = {transaction: tx};
|
||||
const filter = {where: {
|
||||
ticketFk: 1,
|
||||
stateFk: 16}
|
||||
stateFk: stateFkCurrent}
|
||||
};
|
||||
try {
|
||||
const ticketTracking = await models.TicketTracking.findOne(filter, myOptions);
|
||||
await ticketTracking.updateAttributes({
|
||||
stateFk: 7
|
||||
stateFk: stateFkUpdated
|
||||
});
|
||||
const result = await models.TicketCollection.hasUncheckedTicket(ticketFk, myOptions);
|
||||
|
||||
|
|
Loading…
Reference in New Issue