mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Test
This commit is contained in:
parent
6600da990b
commit
74764ee695
1 changed files with 31 additions and 0 deletions
|
|
@ -294,5 +294,36 @@ describe('ManageRoom', () => {
|
|||
expect(screen.queryByText('Student 1')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
test('terminates the quiz and navigates to teacher dashboard when the "Terminer le quiz" button is clicked', async () => {
|
||||
await act(async () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<ManageRoom />
|
||||
</MemoryRouter>
|
||||
);
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
const createSuccessCallback = (mockSocket.on as jest.Mock).mock.calls.find(call => call[0] === 'create-success')[1];
|
||||
createSuccessCallback('Test Room');
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByText('Lancer'));
|
||||
fireEvent.click(screen.getByText('Rythme du professeur'));
|
||||
fireEvent.click(screen.getAllByText('Lancer')[1]);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Test Quiz')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const finishQuizButton = screen.getByText('Terminer le quiz');
|
||||
fireEvent.click(finishQuizButton);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(navigate).toHaveBeenCalledWith('/teacher/dashboard');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue