Skip to content

Commit

Permalink
Corrección test
Browse files Browse the repository at this point in the history
  • Loading branch information
UO285267 committed Mar 10, 2024
1 parent 07c204c commit 0e57d53
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
21 changes: 21 additions & 0 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions webapp/src/components/QuizGame.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ beforeEach(() => {
mockAxios.reset();
});

test('Pregunta correcta', () => {
test('Pregunta correcta', async () => {
mockAxios.onGet('http://localhost:8000/generate-question').reply(200, {
question: "pregunta",
correctAnswer: "correcta",
allAnswers: ["correcta","no1","no2","no3"]});

render(<QuizGame />);
expect(screen.getByText(/Loading questions.../i)).toBeInTheDocument();

question: "pregunta",
correctAnswer: "correcta",
allAnswers: ["correcta", "no1", "no2", "no3"]
});


const correcta = screen.getByRole('button', { name: /correcta/i });
fireEvent.click(correcta);

render(<QuizGame />);
expect(screen.getByText(/Loading questions.../i)).toBeInTheDocument();

// Wait for the asynchronous operation to complete
await screen.findByRole('button', { name: /correcta/i });

});
const correcta = screen.getByRole('button', { name: /correcta/i });
fireEvent.click(correcta);
});

0 comments on commit 0e57d53

Please sign in to comment.