Skip to content

Commit

Permalink
Merge pull request #155 from Arquisoft/150-increase-code-coverage
Browse files Browse the repository at this point in the history
150 increase code coverage
  • Loading branch information
uo289267 authored Apr 28, 2024
2 parents 23cd57f + 7ff4147 commit 2de8ce9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 64 deletions.
2 changes: 1 addition & 1 deletion webapp/src/components/ForgetPassword/RestorePassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function RestorePassword({
<div className="password-strength-meter">
<span>{t(passwordStrengthText)}</span>
<progress
value={passwordStrength ? passwordStrength.score : 0}
value={passwordStrength.scope ?? 0}
max="4"
/>
</div>
Expand Down
21 changes: 21 additions & 0 deletions webapp/src/components/GameConfigurator/GameConfigurator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,25 @@ it('renders option to play Competitive game', () => {
expect(text).toBeInTheDocument();
});

it('should set random values for type and number of questions when randomize button is clicked', () => {
const { getByText, getByRole } = render(<Router><GameConfigurator /></Router>);

// Encuentra el botón de randomize
const randomizeButton = getByText('gameConfigurator.randomize');

// Simula el clic en el botón de randomize
fireEvent.click(randomizeButton);

// Verifica que el tipo de pregunta sea uno de los valores esperados
const select = getByRole('combobox'); // Localiza el campo de selección
const validOptions = ['ALL', 'POPULATION', 'CAPITAL', 'LANGUAGE', 'SIZE', 'HEAD_OF_GOVERMENT'];
expect(validOptions).toContain(select.value); // Verifica que el valor esté en las opciones válidas

// Verifica que el número de preguntas esté entre 1 y 20
const numberInput = getByRole('spinbutton'); // Localiza el spinner
const numQuestions = parseInt(numberInput.value, 10);
expect(numQuestions).toBeGreaterThanOrEqual(1);
expect(numQuestions).toBeLessThanOrEqual(20);
});

});
63 changes: 0 additions & 63 deletions webapp/src/components/ranking/RankingRetriever.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,9 @@ class RankingRetriever{
const receivedTopTenRanking = await response.data;
return receivedTopTenRanking;
} catch (error) {
console.log(error)
throw new Error(error);

}
/*
return {
"usersCompetitiveStats": [
{
"_id": "user",
"totalPoints": 1000,
"totalCompetitiveGames": 4
},
{
"_id": "user2",
"totalPoints": 900,
"totalCompetitiveGames": 2
},
{
"_id": "user3",
"totalPoints": 800,
"totalCompetitiveGames": 3
},
{
"_id": "user4",
"totalPoints": 700,
"totalCompetitiveGames": 5
},
{
"_id": "user5",
"totalPoints": 600,
"totalCompetitiveGames": 6
},
{
"_id": "user6",
"totalPoints": 500,
"totalCompetitiveGames": 7
},
{
"_id": "user7",
"totalPoints": 400,
"totalCompetitiveGames": 8
},
{
"_id": "user8",
"totalPoints": 300,
"totalCompetitiveGames": 9
},
{
"_id": "user9",
"totalPoints": 200,
"totalCompetitiveGames": 10
},
{
"_id": "user10",
"totalPoints": 100,
"totalCompetitiveGames": 11
}
]
}*/
}
async getUser(user, token){

Expand All @@ -81,16 +25,9 @@ class RankingRetriever{
const receivedMyRanking = await response.data;
return receivedMyRanking.userCompetitiveStats;
} catch (error) {
console.log(error)
throw new Error(error);

}
/*
return {
"_id": "myUser",
"totalPoints": 250,
"totalCompetitiveGames": 1
};*/
}


Expand Down

0 comments on commit 2de8ce9

Please sign in to comment.