diff --git a/webapp/package-lock.json b/webapp/package-lock.json
index dd759ba0..612b1a17 100644
--- a/webapp/package-lock.json
+++ b/webapp/package-lock.json
@@ -21,6 +21,7 @@
"react-responsive": "^9.0.2",
"react-router-dom": "^6.22.1",
"react-scripts": "5.0.1",
+ "react-toastify": "^8.0.2",
"web-vitals": "^3.5.1"
},
"devDependencies": {
@@ -23202,6 +23203,26 @@
"node": ">=10"
}
},
+ "node_modules/react-toastify": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-8.2.0.tgz",
+ "integrity": "sha512-Pg2Ju7NngAamarFvLwqrFomJ57u/Ay6i6zfLurt/qPynWkAkOthu6vxfqYpJCyNhHRhR4hu7+bySSeWWJu6PAg==",
+ "dependencies": {
+ "clsx": "^1.1.1"
+ },
+ "peerDependencies": {
+ "react": ">=16",
+ "react-dom": ">=16"
+ }
+ },
+ "node_modules/react-toastify/node_modules/clsx": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",
+ "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/react-transition-group": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
diff --git a/webapp/src/components/QuizGame.test.js b/webapp/src/components/QuizGame.test.js
index 11998be6..20a6a4f0 100644
--- a/webapp/src/components/QuizGame.test.js
+++ b/webapp/src/components/QuizGame.test.js
@@ -9,19 +9,19 @@ beforeEach(() => {
mockAxios.reset();
});
-test('Pregunta correcta', () => {
+ test('Pregunta correcta', async () => {
mockAxios.onGet('http://localhost:8000/generate-question').reply(200, {
- question: "pregunta",
- correctAnswer: "correcta",
- allAnswers: ["correcta","no1","no2","no3"]});
-
- render();
- expect(screen.getByText(/Loading questions.../i)).toBeInTheDocument();
-
+ question: "pregunta",
+ correctAnswer: "correcta",
+ allAnswers: ["correcta", "no1", "no2", "no3"]
+ });
-
- const correcta = screen.getByRole('button', { name: /correcta/i });
- fireEvent.click(correcta);
-
+ render();
+ expect(screen.getByText(/Loading questions.../i)).toBeInTheDocument();
+
+ // Wait for the asynchronous operation to complete
+ await screen.findByRole('button', { name: /correcta/i });
-});
\ No newline at end of file
+ const correcta = screen.getByRole('button', { name: /correcta/i });
+ fireEvent.click(correcta);
+ });
\ No newline at end of file