Skip to content

Commit

Permalink
Checking things
Browse files Browse the repository at this point in the history
  • Loading branch information
lauratbg committed Apr 24, 2024
1 parent 7aedeb0 commit 1137ee1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions webapp/src/components/GameConfigurator/GameConfigurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function GameConfigurator(){
<h1>{t("gameConfigurator.game_config")}</h1>
<h2>{t("gameConfigurator.custo_game")}</h2>
<ButtonRandomizeCustom t={t} handleClick={handleClickRandomize} />
<label for="select">{t("gameConfigurator.type_quest")}</label>
<label htmlFor="select">{t("gameConfigurator.type_quest")}</label>
<select id="select" className="select-style" value={tipoPregunta} onChange={(e) => setTipoPregunta(e.target.value)}>
<option value="ALL">{t("gameConfigurator.option_all")}</option>
<option value="POPULATION">{t("gameConfigurator.option_population")}</option>
Expand All @@ -51,7 +51,7 @@ function GameConfigurator(){
<br></br>
<ButtonCustomized t={t} handleClick={handleClick}/>
<br></br>
<hr class="hr-style"></hr>
<hr className="hr-style"></hr>
<br></br>
<h2>{t("gameConfigurator.competi_game")}</h2>
<p>{t("gameConfigurator.rules_competi")}</p>
Expand Down
44 changes: 22 additions & 22 deletions webapp/src/components/questionView/QuestionGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ class QuestionGenerator{

async generateQuestions(lang, type, amount, token) {

try {
//const response = await fetch(this.apiUrl);
//const receivedQuestions = await response.json();
// try {
// //const response = await fetch(this.apiUrl);
// //const receivedQuestions = await response.json();

//Mockup
console.log("type: "+type+" amount: "+amount)
const receivedQuestions = JSON.parse('{"0":{"question":"What is the population of Oviedo?","answers":["225089","191325","220587","121548"]},'+
'"1":{"question":"¿Cuál es la población de Gijón?","answers":["275274","159658","233982","305554"]},'+
'"2":{"question":"¿Cuál es la población de Avilés?","answers":["82568","115595","41284","122200"]},'+
'"3":{"question":"¿Cuál es la capital de Asturias?","answers":["Ciudad de Oviedo","a","b","c"]},'+
'"4":{"question":"¿Cuál es la capital de España?","answers":["Madrid","a","b","c"]},'+
'"5":{"question":"¿Cuál es la capital de Turquía?","answers":["Ankara","a","b","c"]}}')
// //Mockup
// console.log("type: "+type+" amount: "+amount)
// const receivedQuestions = JSON.parse('{"0":{"question":"What is the population of Oviedo?","answers":["225089","191325","220587","121548"]},'+
// '"1":{"question":"¿Cuál es la población de Gijón?","answers":["275274","159658","233982","305554"]},'+
// '"2":{"question":"¿Cuál es la población de Avilés?","answers":["82568","115595","41284","122200"]},'+
// '"3":{"question":"¿Cuál es la capital de Asturias?","answers":["Ciudad de Oviedo","a","b","c"]},'+
// '"4":{"question":"¿Cuál es la capital de España?","answers":["Madrid","a","b","c"]},'+
// '"5":{"question":"¿Cuál es la capital de Turquía?","answers":["Ankara","a","b","c"]}}')

let i = 0;
var questions = [];
for (const key in receivedQuestions) {
questions[i] = new Question(receivedQuestions[key]);
i += 1;
}
console.log(questions);
return questions;
} catch (error) {
throw new Error(error);
}
// let i = 0;
// var questions = [];
// for (const key in receivedQuestions) {
// questions[i] = new Question(receivedQuestions[key]);
// i += 1;
// }
// console.log(questions);
// return questions;
// } catch (error) {
// throw new Error(error);
// }



Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/questionView/QuestionView.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('Question View component', () => {
}, { timeout: 1000 }); // Esperar 1 segundo
});

it('shows timer', async () => {
it('shows timer ', async () => {
setupAudioMock()
await act(async () =>{
await render(<MemoryRouter><QuestionView /></MemoryRouter>);
Expand All @@ -139,7 +139,7 @@ describe('Question View component', () => {
await waitFor(() => expect(screen.getByText('What is the population of Oviedo?')).toBeInTheDocument());
// expect(global.Audio).toHaveBeenCalledWith('/tictac.mp3');

const timerElement = screen.getByText(new RegExp(`(\\d+) ${i18en.t('questionView.seconds')}`));
const timerElement = screen.getByText(new RegExp((\\d+) ${i18en.t('questionView.seconds')}));
expect(timerElement).toBeInTheDocument(); // Verificar que el temporizador esté presente en el DOM
});

Expand Down Expand Up @@ -171,7 +171,7 @@ describe('Question View component', () => {
// })
// await waitFor(() => expect(screen.getByText('What is the population of Oviedo?')).toBeInTheDocument());

// const timerElement = screen.getByText(new RegExp(`(\\d+) ${i18en.t('questionView.seconds')}`));
// const timerElement = screen.getByText(new RegExp((\\d+) ${i18en.t('questionView.seconds')}));
// expect(timerElement).toBeInTheDocument(); // Verificar que el temporizador esté presente en el DOM


Expand Down

0 comments on commit 1137ee1

Please sign in to comment.