Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

150 increase code coverage #155

Merged
merged 2 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading