diff --git a/api/src/timeslots/timeslots.e2e-spec.ts b/api/src/timeslots/timeslots.e2e-spec.ts index a47ed8e..843a4e5 100644 --- a/api/src/timeslots/timeslots.e2e-spec.ts +++ b/api/src/timeslots/timeslots.e2e-spec.ts @@ -25,7 +25,15 @@ describe('TimeslotsController', () => { let mockUsers: Person[]; let mockTimeSlots: TimeSlot[]; let mockRecruitmentSessions: RecruitmentSession[]; - let mockAvailability: Availability[]; + + class mockAv { + id: number; + state: AvailabilityState; + lastModified: Date; + timeSlot: number; + userOauthId: string; + } + let mockAvailability: mockAv[]; beforeAll(async () => { newMemberToken = await getAccessToken('newMember'); @@ -473,364 +481,364 @@ describe('TimeslotsController', () => { lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 51, userOauthId: '5', - } as unknown as Availability, + } , { id: 2, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 53, userOauthId: '7', - } as unknown as Availability, + } , { id: 3, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 55, userOauthId: '12', - } as unknown as Availability, + } , { id: 4, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 61, userOauthId: '19', - } as unknown as Availability, + } , { id: 5, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 71, userOauthId: '3', - } as unknown as Availability, + } , { id: 6, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 78, userOauthId: '15', - } as unknown as Availability, + } , { id: 7, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 58, userOauthId: '11', - } as unknown as Availability, + } , { id: 8, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 57, userOauthId: '8', - } as unknown as Availability, + } , { id: 9, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 64, userOauthId: '5', - } as unknown as Availability, + } , { id: 10, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 53, userOauthId: '17', - } as unknown as Availability, + } , { id: 11, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 62, userOauthId: '2', - } as unknown as Availability, + } , { id: 12, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 71, userOauthId: '9', - } as unknown as Availability, + } , { id: 13, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 72, userOauthId: '14', - } as unknown as Availability, + } , { id: 14, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 74, userOauthId: '6', - } as unknown as Availability, + } , { id: 15, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 75, userOauthId: '13', - } as unknown as Availability, + } , { id: 16, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 74, userOauthId: '10', - } as unknown as Availability, + } , { id: 17, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 71, userOauthId: '4', - } as unknown as Availability, + } , { id: 18, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 64, userOauthId: '16', - } as unknown as Availability, + } , { id: 19, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 59, userOauthId: '18', - } as unknown as Availability, + } { id: 20, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 57, userOauthId: '1', - } as unknown as Availability, + } , { id: 21, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 66, userOauthId: '20', - } as unknown as Availability, + } , { id: 22, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 68, userOauthId: '19', - } as unknown as Availability, + } , { id: 23, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 69, userOauthId: '7', - } as unknown as Availability, + } , { id: 24, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 70, userOauthId: '16', - } as unknown as Availability, + } , { id: 25, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 72, userOauthId: '15', - } as unknown as Availability, + } , { id: 26, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 73, userOauthId: '11', - } as unknown as Availability, + } , { id: 27, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 75, userOauthId: '14', - } as unknown as Availability, + } , { id: 28, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 76, userOauthId: '9', - } as unknown as Availability, + } , { id: 29, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 77, userOauthId: '8', - } as unknown as Availability, + } , { id: 30, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 78, userOauthId: '10', - } as unknown as Availability, + } , { id: 31, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 79, userOauthId: '13', - } as unknown as Availability, + } , { id: 32, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 80, userOauthId: '12', - } as unknown as Availability, + } , { id: 33, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 79, userOauthId: '20', - } as unknown as Availability, + } , { id: 34, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 78, userOauthId: '18', - } as unknown as Availability, + } , { id: 35, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 77, userOauthId: '17', - } as unknown as Availability, + } , { id: 36, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 76, userOauthId: '19', - } as unknown as Availability, + } , { id: 37, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 75, userOauthId: '16', - } as unknown as Availability, + } , { id: 38, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 74, userOauthId: '15', - } as unknown as Availability, + } , { id: 39, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 73, userOauthId: '14', - } as unknown as Availability, + } , { id: 40, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 72, userOauthId: '13', - } as unknown as Availability, + } , { id: 41, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 71, userOauthId: '12', - } as unknown as Availability, + } , { id: 42, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 70, userOauthId: '11', - } as unknown as Availability, + } , { id: 43, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 69, userOauthId: '10', - } as unknown as Availability, + } , { id: 44, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 68, userOauthId: '9', - } as unknown as Availability, + } , { id: 45, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 67, userOauthId: '8', - } as unknown as Availability, + } , { id: 46, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 66, userOauthId: '7', - } as unknown as Availability, + } , { id: 47, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 65, userOauthId: '6', - } as unknown as Availability, + } , { id: 48, state: AvailabilityState.Interviewing, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 64, userOauthId: '5', - } as unknown as Availability, + } , { id: 49, state: AvailabilityState.Recovering, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 63, userOauthId: '8', - } as unknown as Availability, + } , { id: 50, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 62, userOauthId: '14', - } as unknown as Availability, + } , { id: 51, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 61, userOauthId: '4', - } as unknown as Availability, + } , { id: 52, state: AvailabilityState.Free, lastModified: new Date('2024-05-14 00:00:00'), timeSlot: 60, userOauthId: '13', - } as unknown as Availability, + } , ]; }); @@ -854,13 +862,20 @@ describe('TimeslotsController', () => { const timeSlot = { ...ts, recruitmentSession: mockRecruitmentSessions[2], - availabilities: [], + availabilities: [] as Availability[], }; await timeSlotsService.createTimeSlot(timeSlot); } for (const a of mockAvailability) { - await availabilityService.createAvailability(a); + const availability = { + id: a.id, + state: a.state, + lastModified: a.lastModified, + timeSlot: timeSlotsService.findById(a.timeSlot), + user: mockUsers.find((u) => u.oauthId === a.userOauthId), + } as unknown as Availability; + await availabilityService.createAvailability(availability); } });