From 2ec2f2511cf83a2bc9f4aeabe3841d4213a1709b Mon Sep 17 00:00:00 2001 From: lauratbg Date: Wed, 17 Apr 2024 13:42:44 +0200 Subject: [PATCH] Removing things --- .../components/questionView/QuestionView.js | 5 +---- .../questionView/QuestionView.test.js | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/webapp/src/components/questionView/QuestionView.js b/webapp/src/components/questionView/QuestionView.js index e4412a43..ca598e11 100644 --- a/webapp/src/components/questionView/QuestionView.js +++ b/webapp/src/components/questionView/QuestionView.js @@ -155,11 +155,8 @@ function QuestionComponent({questions, numQuestion, handleClick, t, points, audi speech.addEventListener("end", () => { const voices = window.speechSynthesis.getVoices(); - if (voices.length > 0) { + if (voices.length > 0) resolve(voices); - } else { - reject("No se encontraron voces disponibles."); - } }); window.speechSynthesis.speak(speech); diff --git a/webapp/src/components/questionView/QuestionView.test.js b/webapp/src/components/questionView/QuestionView.test.js index f747fe35..a3a34531 100644 --- a/webapp/src/components/questionView/QuestionView.test.js +++ b/webapp/src/components/questionView/QuestionView.test.js @@ -37,6 +37,7 @@ configure({ }); const mockAxios = new MockAdapter(axios); +jest.setTimeout(10000); i18en.use(initReactI18next).init({ @@ -160,5 +161,25 @@ describe('Question View component', () => { }); + // it('renders end message when countdown completes', async() => { + + // setupAudioMock() + // mockAxios.onGet('http://localhost:8000/questions/en').reply(200, + // [{question: "What is the population of Oviedo?", + // answers: ["225089","272357","267855","231841"]}]); + // await act(async () =>{ + // await render(); + + // }) + // await waitFor(() => expect(screen.getByText('What is the population of Oviedo?')).toBeInTheDocument()); + + // const timerElement = screen.getByText(new RegExp(`(\\d+) ${i18en.t('questionView.seconds')}`)); + // expect(timerElement).toBeInTheDocument(); // Verificar que el temporizador esté presente en el DOM + + + // await waitFor(() => { + // expect(screen.getByText("Time's up!")).toBeInTheDocument(); + // }, { timeout: 9800 }); // Esperar 10 segundos + // }); }); \ No newline at end of file