mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
2 commits
c9b76df2cd
...
81c530eac6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81c530eac6 | ||
|
|
9286fe6b9c |
3 changed files with 20 additions and 13 deletions
|
|
@ -17,6 +17,7 @@ describe('StudentWaitPage Component', () => {
|
||||||
launchQuiz: jest.fn(),
|
launchQuiz: jest.fn(),
|
||||||
roomName: 'Test Room',
|
roomName: 'Test Room',
|
||||||
setQuizMode: jest.fn(),
|
setQuizMode: jest.fn(),
|
||||||
|
setIsRoomSelectionVisible: jest.fn()
|
||||||
};
|
};
|
||||||
|
|
||||||
test('renders StudentWaitPage with correct content', () => {
|
test('renders StudentWaitPage with correct content', () => {
|
||||||
|
|
@ -39,5 +40,4 @@ describe('StudentWaitPage Component', () => {
|
||||||
|
|
||||||
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
})
|
|
||||||
|
|
|
||||||
|
|
@ -201,6 +201,16 @@ const ManageRoom: React.FC = () => {
|
||||||
webSocketService.launchStudentModeQuiz(roomName, quizQuestions);
|
webSocketService.launchStudentModeQuiz(roomName, quizQuestions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('join-failure', (message) => {
|
||||||
|
setConnectingError(message);
|
||||||
|
setSocket(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('user-disconnected', (userId: string) => {
|
||||||
|
console.log(`Student left: id = ${userId}`);
|
||||||
|
setStudents((prevUsers) => prevUsers.filter((user) => user.id !== userId));
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (rooms.length === 0) {
|
if (rooms.length === 0) {
|
||||||
|
|
@ -233,7 +243,6 @@ const ManageRoom: React.FC = () => {
|
||||||
console.log(`Listening for user-joined in room ${roomName}`);
|
console.log(`Listening for user-joined in room ${roomName}`);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
socket.on('user-joined', (_student: StudentType) => {
|
socket.on('user-joined', (_student: StudentType) => {
|
||||||
console.log("📢 Nouvel étudiant ajouté:", _student);
|
|
||||||
if (quizMode === 'teacher') {
|
if (quizMode === 'teacher') {
|
||||||
webSocketService.nextQuestion(roomName, currentQuestion);
|
webSocketService.nextQuestion(roomName, currentQuestion);
|
||||||
} else if (quizMode === 'student') {
|
} else if (quizMode === 'student') {
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,6 @@ describe('Rooms', () => {
|
||||||
|
|
||||||
it('should return false if room does not exist', async () => {
|
it('should return false if room does not exist', async () => {
|
||||||
const title = 'Nonexistent Room';
|
const title = 'Nonexistent Room';
|
||||||
const userId = '12345';
|
|
||||||
|
|
||||||
// Mock the database response
|
// Mock the database response
|
||||||
collection.findOne.mockResolvedValue(null);
|
collection.findOne.mockResolvedValue(null);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue