Skip to content

Commit

Permalink
check that number of answars cant be < 2
Browse files Browse the repository at this point in the history
  • Loading branch information
uo288574 committed Apr 26, 2024
1 parent f25b65b commit e322573
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 0 additions & 1 deletion webapp/src/components/game/GameConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const apiEndpoint = process.env.REACT_APP_API_ENDPOINT|| 'http://localhost:8000'

let gameId;
let questions = []
const previousBackgroundColor = '#1a1a1a'

const GameConfiguration = () => {

Expand Down
17 changes: 17 additions & 0 deletions webapp/src/components/game/GameConfiguration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,22 @@ describe("Game Configuration", () => {
expect(input.value).toBe('5');
});

test("try to put number of answers < 2",async () => {

const { getByLabelText } =
render(
<ContextFun>
<Router>
<GameConfiguration />
</Router>
</ContextFun>
);

const input = getByLabelText('Número de respuestas:');
fireEvent.change(input, { target: { value: '1' } });
expect(input.value).toBe('2');
expect(screen.getAllByText(/El número de respuestas debe ser mayor que 2/i)[0]).toBeInTheDocument();
});

});

0 comments on commit e322573

Please sign in to comment.