diff --git a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js index 1ea522de6..43f6faa96 100644 --- a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js +++ b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js @@ -35,6 +35,6 @@ module.exports = Self => { WHERE tc.ticketFk = ? AND s.order < s2.id LIMIT 1;`, [ticketFk], myOptions); - return result.length > 0 && result[0]['ticketFk'] > 0; + return result[0]?.ticketFk > 0 && result[0].ticketFk; }; }; diff --git a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js index ae7a8e6ee..a75784a23 100644 --- a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js +++ b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js @@ -27,7 +27,7 @@ describe('ticketCollection hasUncheckedTicket()', () => { }, myOptions); const result = await models.TicketCollection.hasUncheckedTicket(ticketFk, myOptions); - expect(result).toBe(true); + expect(result).toBeTruthy(); await tx.rollback(); } catch (e) { await tx.rollback();