diff --git a/client/src/Types/UserType.tsx b/client/src/Types/StudentType.tsx similarity index 52% rename from client/src/Types/UserType.tsx rename to client/src/Types/StudentType.tsx index e7ef41d..833856e 100644 --- a/client/src/Types/UserType.tsx +++ b/client/src/Types/StudentType.tsx @@ -1,4 +1,4 @@ -export interface UserType { - name: string; - id: string; -} +export interface StudentType { + name: string; + id: string; +} diff --git a/client/src/__tests__/Types/StudentType.test.tsx b/client/src/__tests__/Types/StudentType.test.tsx new file mode 100644 index 0000000..a7830d0 --- /dev/null +++ b/client/src/__tests__/Types/StudentType.test.tsx @@ -0,0 +1,15 @@ +//StudentType.test.tsx +import { StudentType } from "../../Types/StudentType"; + +const user : StudentType = { + name: 'Student', + id: '123' +} + +describe('StudentType', () => { + test('creates a student with name and id', () => { + + expect(user.name).toBe('Student'); + expect(user.id).toBe('123'); + }); +}); diff --git a/client/src/__tests__/Types/UserType.test.tsx b/client/src/__tests__/Types/UserType.test.tsx deleted file mode 100644 index 97ebfa9..0000000 --- a/client/src/__tests__/Types/UserType.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -//UserTyper.test.tsx -import { UserType } from "../../Types/UserType"; - -const user : UserType = { - name: 'Student', - id: '123' -} - -describe('UserType', () => { - test('creates a user with name and id', () => { - - expect(user.name).toBe('Student'); - expect(user.id).toBe('123'); - }); -}); diff --git a/client/src/components/LiveResults/LiveResults.tsx b/client/src/components/LiveResults/LiveResults.tsx index d5fe728..67e2927 100644 --- a/client/src/components/LiveResults/LiveResults.tsx +++ b/client/src/components/LiveResults/LiveResults.tsx @@ -19,7 +19,7 @@ import { TableHead, TableRow } from '@mui/material'; -import { UserType } from '../../Types/UserType'; +import { StudentType } from '../../Types/StudentType'; import { formatLatex } from '../GiftTemplate/templates/TextType'; interface LiveResultsProps { @@ -27,7 +27,7 @@ interface LiveResultsProps { questions: QuestionType[]; showSelectedQuestion: (index: number) => void; quizMode: 'teacher' | 'student'; - students: UserType[] + students: StudentType[] } interface Answer { @@ -64,7 +64,7 @@ const LiveResults: React.FC = ({ socket, questions, showSelect useEffect(() => { // studentResultsMap is inconsistent with students -- need to update - for (const student of students as UserType[]) { + for (const student of students as StudentType[]) { if (!studentResultsMap.has(student.id)) { studentResultsMap.set(student.id, { username: student.name, idUser: student.id, answers: [] }); } diff --git a/client/src/components/UserWaitPage/UserWaitPage.tsx b/client/src/components/UserWaitPage/UserWaitPage.tsx index 41b608c..db4e110 100644 --- a/client/src/components/UserWaitPage/UserWaitPage.tsx +++ b/client/src/components/UserWaitPage/UserWaitPage.tsx @@ -1,12 +1,12 @@ import { Button, Chip, Grid } from '@mui/material'; -import { UserType } from '../../Types/UserType'; +import { StudentType } from '../../Types/StudentType'; import { PlayArrow } from '@mui/icons-material'; import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog'; import { useState } from 'react'; import './userWaitPage.css'; interface Props { - users: UserType[]; + users: StudentType[]; launchQuiz: () => void; setQuizMode: (mode: 'student' | 'teacher') => void; } diff --git a/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx b/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx index 582882d..4bb3161 100644 --- a/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx +++ b/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx @@ -11,7 +11,7 @@ import { QuizType } from '../../../Types/QuizType'; import './manageRoom.css'; import { ENV_VARIABLES } from '../../../constants'; -import { UserType } from '../../../Types/UserType'; +import { StudentType } from '../../../Types/StudentType'; import { Button } from '@mui/material'; import LoadingCircle from '../../../components/LoadingCircle/LoadingCircle'; import { Refresh, Error } from '@mui/icons-material'; @@ -25,7 +25,7 @@ const ManageRoom: React.FC = () => { const navigate = useNavigate(); const [roomName, setRoomName] = useState(''); const [socket, setSocket] = useState(null); - const [students, setStudents] = useState([]); + const [students, setStudents] = useState([]); const quizId = useParams<{ id: string }>(); const [quizQuestions, setQuizQuestions] = useState(); const [quiz, setQuiz] = useState(null); @@ -96,7 +96,7 @@ const ManageRoom: React.FC = () => { socket.on('create-failure', () => { console.log('Error creating room.'); }); - socket.on('user-joined', (student: UserType) => { + socket.on('user-joined', (student: StudentType) => { setStudents((prevStudents) => [...prevStudents, student]); @@ -119,7 +119,7 @@ const ManageRoom: React.FC = () => { useEffect(() => { // This is here to make sure the correct value is sent when user join if (socket) { - socket.on('user-joined', (_student: UserType) => { + socket.on('user-joined', (_student: StudentType) => { // setUsers((prevUsers) => [...prevUsers, user]);