Skip to content

Commit

Permalink
Cambios para tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosMachadoMenendez committed Mar 10, 2024
1 parent 1d9d0f9 commit c66f7eb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion webapp/src/components/Home.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import Home from './Home';
import userEvent from '@testing-library/user-event';
import {BrowserRouter} from 'react-router-dom';
Expand Down
27 changes: 27 additions & 0 deletions webapp/src/components/QuizGame.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { render, screen, fireEvent } from '@testing-library/react';
import QuizGame from './QuizGame';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';

const mockAxios = new MockAdapter(axios);

beforeEach(() => {
mockAxios.reset();
});

test('Pregunta correcta', () => {
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();



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


});
6 changes: 3 additions & 3 deletions webapp/src/components/login/Login.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
}

.text{
margin-top: 20ev;
margin-top: 20px;
text-align: center;
font-size: 20ev;
font-size: 20px;
font-weight: bold;
font-display: 'Fira Sans', sans-serif;
}

.underline{
width: 20%;
margin-top: 7ev;
margin-top: 7px;
height: 0.5em;
border-radius: 9em;
background: #EE0E51;
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/components/register/AddUser.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
}

.text{
margin-top: 20ev;
margin-top: 20px;
text-align: center;
font-size: 20ev;
font-size: 20px;
font-weight: bold;
font-display: 'Fira Sans', sans-serif;
}

.underline{
width: 20%;
margin-top: 7ev;
margin-top: 7px;
height: 0.5em;
border-radius: 9px;
background: #EE0E51;
Expand Down

0 comments on commit c66f7eb

Please sign in to comment.