diff --git a/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx b/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx index 0332f1a..6734114 100644 --- a/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx +++ b/client/src/__tests__/pages/Student/TeacherModeQuiz/TeacherModeQuiz.test.tsx @@ -4,13 +4,11 @@ import { render, fireEvent, act } from '@testing-library/react'; import { screen } from '@testing-library/dom'; import '@testing-library/jest-dom'; import { MultipleChoiceQuestion, parse } from 'gift-pegjs'; - import TeacherModeQuiz from 'src/components/TeacherModeQuiz/TeacherModeQuiz'; import { MemoryRouter } from 'react-router-dom'; -// import { mock } from 'node:test'; const mockGiftQuestions = parse( - `::Sample Question:: Sample Question {=Option A ~Option B}`); + `::Question:: Sample Question {=Option A ~Option B}`); describe('TeacherModeQuiz', () => { @@ -36,6 +34,7 @@ describe('TeacherModeQuiz', () => { }); test('renders the initial question', () => { + expect(screen.getByText('Question 1')).toBeInTheDocument(); expect(screen.getByText('Sample Question')).toBeInTheDocument(); expect(screen.getByText('Option A')).toBeInTheDocument(); @@ -53,7 +52,6 @@ describe('TeacherModeQuiz', () => { fireEvent.click(screen.getByText('Répondre')); }); expect(mockSubmitAnswer).toHaveBeenCalledWith('Option A', 1); - expect(screen.getByText('Votre réponse est:')).toBeInTheDocument(); }); test('handles disconnect button click', () => { diff --git a/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx b/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx index c8e8f69..c3658c2 100644 --- a/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx +++ b/client/src/components/QuestionsDisplay/MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay.tsx @@ -14,7 +14,7 @@ interface Props { const MultipleChoiceQuestionDisplay: React.FC = (props) => { const { question, showAnswer, handleOnSubmitAnswer, passedAnswer } = props; - const [answer, setAnswer] = useState(passedAnswer || ' '); + const [answer, setAnswer] = useState(passedAnswer || ''); let disableButton = false; @@ -33,8 +33,8 @@ const MultipleChoiceQuestionDisplay: React.FC = (props) => { }; const alpha = Array.from(Array(26)).map((_e, i) => i + 65); const alphabet = alpha.map((x) => String.fromCharCode(x)); - return ( +
@@ -43,7 +43,6 @@ const MultipleChoiceQuestionDisplay: React.FC = (props) => { {question.choices.map((choice, i) => { const selected = answer === choice.formattedText.text ? 'selected' : ''; - console.log("dsa", selected) return (