From 39b1e9ff7bc77c68f57ca957e7c9c72879fb5740 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 27 Mar 2024 07:26:11 +0100 Subject: [PATCH] refs #3520 hasUncheckedTicket --- .../back/methods/ticket-collection/hasUncheckedTicket.js | 2 +- .../ticket-collection/spec/hasUncheckedTicket.spec.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js index 1c51749696..dc4da2ae6c 100644 --- a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js +++ b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js @@ -19,7 +19,7 @@ module.exports = Self => { } }); - Self.getUncheckedTicket = async(ticketFk, options) => { + Self.hasUncheckedTicket = async(ticketFk, options) => { const myOptions = {}; if (typeof options == 'object') 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 02db364b22..9f88b9f0b4 100644 --- a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js +++ b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js @@ -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);