Skip to content

Commit

Permalink
test: test update #400
Browse files Browse the repository at this point in the history
  • Loading branch information
bsilkyn committed May 7, 2024
1 parent b479e97 commit 455ed66
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions frontend/src/test/unit/services/student_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('students', (): void => {
expect(student.value?.first_name).toBe('John');
expect(student.value?.last_name).toBe('Doe');
expect(student.value?.last_enrolled).toBe(2023);
expect(student.value?.studentId).toBeNull();
expect(student.value?.student_id).toBeNull();
expect(student.value?.last_login).toBeNull();
expect(student.value?.create_time.toISOString()).toEqual('2024-07-20T23:15:00.000Z');
expect(student.value?.courses).toEqual([]);
Expand All @@ -60,7 +60,7 @@ describe('students', (): void => {
expect(students.value?.[0]?.first_name).toBe('John');
expect(students.value?.[0]?.last_name).toBe('Doe');
expect(students.value?.[0]?.last_enrolled).toBe(2023);
expect(students.value?.[0]?.studentId).toBeNull();
expect(students.value?.[0]?.student_id).toBeNull();
expect(students.value?.[0]?.last_login).toBeNull();
expect(students.value?.[0]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[0]?.courses).toEqual([]);
Expand All @@ -73,7 +73,7 @@ describe('students', (): void => {
expect(students.value?.[1]?.first_name).toBe('Bartje');
expect(students.value?.[1]?.last_name).toBe('Verhaege');
expect(students.value?.[1]?.last_enrolled).toBe(2023);
expect(students.value?.[1]?.studentId).toBeNull();
expect(students.value?.[1]?.student_id).toBeNull();
expect(students.value?.[1]?.last_login).toBeNull();
expect(students.value?.[1]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[1]?.courses).toEqual([]);
Expand All @@ -86,7 +86,7 @@ describe('students', (): void => {
expect(students.value?.[2]?.first_name).toBe('Tybo');
expect(students.value?.[2]?.last_name).toBe('Verslype');
expect(students.value?.[2]?.last_enrolled).toBe(2023);
expect(students.value?.[2]?.studentId).toBe('02012470');
expect(students.value?.[2]?.student_id).toBe('02012470');
expect(students.value?.[2]?.last_login).toEqual(new Date('July 30, 2024 01:15:00'));
expect(students.value?.[2]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[2]?.courses).toEqual([]);
Expand All @@ -99,7 +99,7 @@ describe('students', (): void => {
expect(students.value?.[3]?.first_name).toBe('somtin');
expect(students.value?.[3]?.last_name).toBe('somtin');
expect(students.value?.[3]?.last_enrolled).toBe(2023);
expect(students.value?.[3]?.studentId).toBeNull();
expect(students.value?.[3]?.student_id).toBeNull();
expect(students.value?.[3]?.last_login).toBeNull();
expect(students.value?.[3]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[3]?.courses).toEqual([]);
Expand All @@ -121,7 +121,7 @@ describe('students', (): void => {
expect(students.value?.[0]?.first_name).toBe('John');
expect(students.value?.[0]?.last_name).toBe('Doe');
expect(students.value?.[0]?.last_enrolled).toBe(2023);
expect(students.value?.[0]?.studentId).toBeNull();
expect(students.value?.[0]?.student_id).toBeNull();
expect(students.value?.[0]?.last_login).toBeNull();
expect(students.value?.[0]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[0]?.courses).toEqual([]);
Expand All @@ -134,7 +134,7 @@ describe('students', (): void => {
expect(students.value?.[1]?.first_name).toBe('Bartje');
expect(students.value?.[1]?.last_name).toBe('Verhaege');
expect(students.value?.[1]?.last_enrolled).toBe(2023);
expect(students.value?.[1]?.studentId).toBeNull();
expect(students.value?.[1]?.student_id).toBeNull();
expect(students.value?.[1]?.last_login).toBeNull();
expect(students.value?.[1]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[1]?.courses).toEqual([]);
Expand All @@ -147,7 +147,7 @@ describe('students', (): void => {
expect(students.value?.[2]?.first_name).toBe('Tybo');
expect(students.value?.[2]?.last_name).toBe('Verslype');
expect(students.value?.[2]?.last_enrolled).toBe(2023);
expect(students.value?.[2]?.studentId).toBe('02012470');
expect(students.value?.[2]?.student_id).toBe('02012470');
expect(students.value?.[2]?.last_login).toEqual(new Date('July 30, 2024 01:15:00'));
expect(students.value?.[2]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[2]?.courses).toEqual([]);
Expand All @@ -160,7 +160,7 @@ describe('students', (): void => {
expect(students.value?.[3]?.first_name).toBe('somtin');
expect(students.value?.[3]?.last_name).toBe('somtin');
expect(students.value?.[3]?.last_enrolled).toBe(2023);
expect(students.value?.[3]?.studentId).toBeNull();
expect(students.value?.[3]?.student_id).toBeNull();
expect(students.value?.[3]?.last_login).toBeNull();
expect(students.value?.[3]?.create_time).toEqual(new Date('July 21, 2024 01:15:00'));
expect(students.value?.[3]?.courses).toEqual([]);
Expand Down Expand Up @@ -202,6 +202,6 @@ describe('students', (): void => {

// Only check for fields that are sent to the backend
expect(students.value?.[prevLength]?.id).toBe('id');
expect(students.value?.[prevLength]?.studentId).toBe('studentId');
expect(students.value?.[prevLength]?.student_id).toBe('studentId');
});
});
2 changes: 1 addition & 1 deletion frontend/src/test/unit/types/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const studentData = {
courses: [],
create_time: new Date(),
last_login: null,
studentId: '1',
student_id: '1',
groups: [],
};

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/test/unit/types/student.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('student type', () => {
expect(student.last_enrolled).toBe(studentData.last_enrolled);
expect(student.create_time).toStrictEqual(studentData.create_time);
expect(student.last_login).toStrictEqual(studentData.last_login);
expect(student.studentId).toBe(studentData.studentId);
expect(student.student_id).toBe(studentData.student_id);
expect(student.roles).toStrictEqual(studentData.roles);
expect(student.courses).toStrictEqual(studentData.courses);
expect(student.groups).toStrictEqual(studentData.groups);
Expand All @@ -39,7 +39,7 @@ describe('student type', () => {
expect(student.last_enrolled).toBe(studentData.last_enrolled);
expect(student.create_time).toStrictEqual(studentData.create_time);
expect(student.last_login).toStrictEqual(studentData.last_login);
expect(student.studentId).toBe(studentData.studentId);
expect(student.student_id).toBe(studentData.student_id);
expect(student.roles).toStrictEqual(studentData.roles);
expect(student.courses).toStrictEqual(studentData.courses);
expect(student.groups).toStrictEqual(studentData.groups);
Expand Down

0 comments on commit 455ed66

Please sign in to comment.