Skip to content

Commit

Permalink
Fixing issues de Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
uo276026 committed Apr 28, 2024
1 parent 0bceae4 commit add7c77
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gatewayservice/gateway-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ app.post('/login', async (req, res) => {

app.post('/adduser', async (req, res) => {
try {
const { username, password, valido, mensajeError } = req.body;
const { valido, mensajeError } = req.body;

if (!valido) {
// Si las credenciales son inválidas, devuelve un error 401
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/AddUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const AddUser = () => {

const addUser = async () => {
try {
var valido = await validateCredentials(username, password);
let valido = await validateCredentials(username, password);
await axios.post(`${apiEndpoint}/adduser`, { username, password, valido, mensajeError });
setOpenSnackbar(true);
} catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions webapp/src/components/Pages/Estadisticas.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const Estadisticas = ({isLogged, username}) => {
const [correctAnswers, setCorrectAnswers] = useState(0);
const [incorrectAnswers, setIncorrectAnswers] = useState(0);
const [completedGames, setCompletedGames] = useState(0);
//const [averageTime, setAverageTime] = useState(0);
const [firstRender, setFirstRender] = useState(false);

useEffect(() => {
Expand All @@ -30,7 +29,6 @@ const Estadisticas = ({isLogged, username}) => {
setCorrectAnswers(datos.user.correctAnswers);
setIncorrectAnswers(datos.user.incorrectAnswers);
setCompletedGames(datos.user.completedGames);
//setAverageTime(datos.user.averageTime);
} catch (error) {
setError('Error al cargar la información');
}
Expand Down
2 changes: 0 additions & 2 deletions webapp/src/components/tests/Estadisticas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ describe('Estadisticas Component', () => {
expect(getByText('Nº Juegos completados:')).toBeInTheDocument();
expect(getByText('20')).toBeInTheDocument(); // Verifica que el número de juegos completados sea 20

//expect(getByText('Tiempo medio por juego:')).toBeInTheDocument();
//expect(getByText('30')).toBeInTheDocument(); // Verifica que el tiempo medio por juego sea 30
});
});

Expand Down
2 changes: 0 additions & 2 deletions webapp/src/components/tests/Juego.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ describe('Juego component', () => {
await waitFor(() => getByText(mockData.question));
fireEvent.click(getByText('SIGUIENTE'));
fireEvent.click(getByText('GUARDAR ESTADÍSTICAS'));
//expect(getByText('GUARDAR ESTADÍSTICAS')).toBeDisabled();
expect(getByText('Comience nueva partida o visite sus estadísticas!!')).toBeInTheDocument()
//expect(axios.get).toHaveBeenCalledWith('http://localhost:8000/updateStats?username=test&numRespuestasCorrectas=0&numRespuestasIncorrectas=0');
});

it('el temporizador llega a 0 y se desvelan las respuestas ademas de bloquearse los botones', async () => {
Expand Down

0 comments on commit add7c77

Please sign in to comment.