diff --git a/docs/src/13_testability.adoc b/docs/src/13_testability.adoc index 1907bfd4..7d61329a 100644 --- a/docs/src/13_testability.adoc +++ b/docs/src/13_testability.adoc @@ -1,6 +1,6 @@ ifndef::imagesdir[:imagesdir: ../images] -[[section-technical-risks]] +[[section-testability]] == Testability Testability is a crucial aspect of software development. It refers to the ease with which a software system can be tested to ensure its correctness and reliability. By writing tests, developers can verify that their code behaves as expected and identify any potential issues or bugs. There are various types of tests that can be performed, such as unit tests, integration tests, and end-to-end tests. Unit tests focus on testing individual components or functions in isolation, while integration tests verify the interaction between different components. End-to-end tests simulate real-world scenarios to ensure the entire system functions correctly. diff --git a/webapp/src/components/Game.js b/webapp/src/components/Game.js index 9c3a1d27..cc705895 100644 --- a/webapp/src/components/Game.js +++ b/webapp/src/components/Game.js @@ -200,10 +200,8 @@ const Game = () => { button.onmouse = colorOnMousePreguntas; }); - incrementQuestion(); - - - + setQuestionCounter(qc => qc + 1); + }catch (error){ console.error('Error:', error); @@ -227,7 +225,7 @@ const Game = () => { const correctButton = document.getElementById(buttonId); if (correctButton) { correctButton.style.backgroundColor = "rgba(79, 141, 18, 0.726)"; - incrementCorrect(); + setCorrectCounter(correct => correct + 1); } }else{ const buttonId = `button_${index}`; @@ -244,7 +242,7 @@ const Game = () => { } } - incrementIncorrect(); + setIncorrectCounter(incorrect => incorrect + 1); } const buttons = document.querySelectorAll('button[title="btnsPreg"]'); @@ -253,7 +251,7 @@ const Game = () => { button.onmouse = null; }); - decrementQuestionsToAnswer(); + setQuestionsToAnswer(toAnswer => toAnswer - 1); if (!isGameFinished()) { setTimeout(() => { @@ -314,14 +312,6 @@ const getQuestions = () => { correctAnswers: correctCounter, incorrectAnswers: numberOfQuestions-correctCounter }; - //console.log("Se va a guardar la siguiente partida:"); - //console.log("Username:", newGame.username); - //console.log("Duración:", newGame.duration); - //console.log("Preguntas:", newGame.questions); - //console.log("Porcentaje de Aciertos:", newGame.percentage); - //console.log("Número Total de Preguntas:", newGame.totalQuestions); - //console.log("Número de Respuestas Correctas:", newGame.correctAnswers); - //console.log("Número de Respuestas Incorrectas:", newGame.incorrectAnswers); setGameData(newGame); @@ -334,24 +324,6 @@ const getQuestions = () => { }); } - const incrementCorrect = () => { - setCorrectCounter(correct => correct + 1); - }; - - const incrementIncorrect = () => { - setIncorrectCounter(incorrect => incorrect + 1); - } - - const decrementQuestionsToAnswer = () => { - setQuestionsToAnswer(toAnswer => toAnswer - 1); - } - - const incrementQuestion = () => { - setQuestionCounter(qc => qc + 1); - } - - - useEffect(() => { if (isTimedOut && !isFinished) { // mostrar la respuesta correcta @@ -364,8 +336,8 @@ const getQuestions = () => { } } - incrementIncorrect(); - decrementQuestionsToAnswer(); + setIncorrectCounter(incorrect => incorrect + 1); + setQuestionsToAnswer(toAnswer => toAnswer - 1); setTimeout(() => { if (!isGameFinished()) { @@ -417,7 +389,7 @@ const getQuestions = () => { -