diff --git a/webapp/src/components/game/gameModes/DailyGameMode.js b/webapp/src/components/game/gameModes/DailyGameMode.js index 209af9a..8e5181f 100644 --- a/webapp/src/components/game/gameModes/DailyGameMode.js +++ b/webapp/src/components/game/gameModes/DailyGameMode.js @@ -110,20 +110,7 @@ class DailyGameMode extends BasicGame{ } async volverAJugarCoockie(){ - Swal.fire({ - title: i18n.t('basicGameEnd'), - html: ` -
: ${i18n.t('correctAnswers')} ${this.correctas}
- `, - confirmButtonText: i18n.t('close'), - customClass: { - popup: 'finDelJuego' - } - }).then(()=>{ - - this.navigate('/home'); - - }); + this.imprimirPopUP(); // Obtener la fecha actual y establecer la hora a las 12 de la noche let expiryDate = new Date(); @@ -160,6 +147,23 @@ class DailyGameMode extends BasicGame{ console.error('Error enviando los datos de diaria del usuario:', error); } } + + imprimirPopUP(){ + Swal.fire({ + title: i18n.t('basicGameEnd'), + html: ` +: ${i18n.t('correctAnswers')} ${this.correctas}
+ `, + confirmButtonText: i18n.t('close'), + customClass: { + popup: 'finDelJuego' + } + }).then(()=>{ + + this.navigate('/home'); + + }); + } fechaActual(){ const fecha = new Date(); // Obtenemos la fecha actual diff --git a/webapp/src/components/game/gameModes/DailyGameMode.test.js b/webapp/src/components/game/gameModes/DailyGameMode.test.js index 9e5003d..455e6f5 100644 --- a/webapp/src/components/game/gameModes/DailyGameMode.test.js +++ b/webapp/src/components/game/gameModes/DailyGameMode.test.js @@ -1,10 +1,10 @@ import DailyGameMode from './DailyGameMode'; import axios from 'axios'; -import { render } from '@testing-library/react'; -import { BrowserRouter as Router } from 'react-router-dom'; -import { AuthContext } from '../../authcontext'; -import { ThemeProvider,createTheme } from '@mui/material/styles'; +import { createTheme } from '@mui/material/styles'; +jest.mock('i18next', () => ({ + t: jest.fn(), +})); jest.mock('axios'); describe('DailyGameMode', () => { let dailyGameMode; @@ -21,8 +21,13 @@ describe('DailyGameMode', () => { }); beforeEach(() => { dailyGameMode = new DailyGameMode(); + dailyGameMode.imprimirPopUP = jest.fn(); + + }); + + afterEach(() => { jest.clearAllMocks(); });