User -> Student (page, tests)

This commit is contained in:
C. Fuhrman 2024-09-25 13:20:09 -04:00
parent 68d7d8c0a9
commit fa4b6b5bd3
5 changed files with 71 additions and 63 deletions

View file

@ -1,4 +1,12 @@
export interface Answer {
answer: string | number | boolean;
isCorrect: boolean;
idQuestion: number;
}
export interface StudentType {
name: string;
id: string;
room?: string;
answers?: Answer[];
}

View file

@ -1,9 +1,9 @@
// Importez le type UserType s'il n'est pas déjà importé
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import UserWaitPage from '../../../components/UserWaitPage/UserWaitPage';
import StudentWaitPage from '../../../components/StudentWaitPage/StudentWaitPage';
describe('UserWaitPage Component', () => {
describe('StudentWaitPage Component', () => {
const mockUsers = [
{ id: '1', name: 'User1' },
{ id: '2', name: 'User2' },
@ -17,8 +17,8 @@ describe('UserWaitPage Component', () => {
setQuizMode: jest.fn(),
};
test('renders UserWaitPage with correct content', () => {
render(<UserWaitPage {...mockProps} />);
test('renders StudentWaitPage with correct content', () => {
render(<StudentWaitPage {...mockProps} />);
//expect(screen.getByText(/Test Room/)).toBeInTheDocument();
@ -31,7 +31,7 @@ describe('UserWaitPage Component', () => {
});
test('clicking on "Lancer" button opens LaunchQuizDialog', () => {
render(<UserWaitPage {...mockProps} />);
render(<StudentWaitPage {...mockProps} />);
fireEvent.click(screen.getByRole('button', { name: /Lancer/i }));

View file

@ -3,7 +3,7 @@ import { StudentType } from '../../Types/StudentType';
import { PlayArrow } from '@mui/icons-material';
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
import { useState } from 'react';
import './userWaitPage.css';
import './studentWaitPage.css';
interface Props {
users: StudentType[];
@ -11,7 +11,7 @@ interface Props {
setQuizMode: (mode: 'student' | 'teacher') => void;
}
const UserWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
const StudentWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
const [isDialogOpen, setIsDialogOpen] = useState<boolean>(false);
return (
@ -53,4 +53,4 @@ const UserWaitPage: React.FC<Props> = ({ users, launchQuiz, setQuizMode }) => {
);
};
export default UserWaitPage;
export default StudentWaitPage;

View file

@ -15,7 +15,7 @@ import { StudentType } from '../../../Types/StudentType';
import { Button } from '@mui/material';
import LoadingCircle from '../../../components/LoadingCircle/LoadingCircle';
import { Refresh, Error } from '@mui/icons-material';
import UserWaitPage from '../../../components/UserWaitPage/UserWaitPage';
import StudentWaitPage from '../../../components/StudentWaitPage/StudentWaitPage';
import DisconnectButton from '../../../components/DisconnectButton/DisconnectButton';
import QuestionNavigation from '../../../components/QuestionNavigation/QuestionNavigation';
import Question from '../../../components/Questions/Question';
@ -311,7 +311,7 @@ const ManageRoom: React.FC = () => {
) : (
<UserWaitPage
<StudentWaitPage
users={students}
launchQuiz={launchQuiz}
setQuizMode={setQuizMode}