-
- {selectedTeamData?.isJobActive
- ? 'Pause Attendance'
- : 'Resume Attendance'}
-
+
Loading Data...
+ {teamAttendanceLoading || teamsLoading || teamLoading ? (
+ <>
+
+ >
+ ) : (
+ <>
+
+ {pauseResumeAttendance && (
+
+
+
+
+ {selectedTeamData?.isJobActive
+ ? 'Pause Attendance'
+ : 'Resume Attendance'}
+
+
+
+ {selectedTeamData?.isJobActive
+ ? "By confirming, automatic attendance week additions for upcoming weeks will be paused. You can still record attendance for the current week. Don't worry you can reactivate this feature at any time!."
+ : "By confirming, automatic attendance week additions for upcoming weeks will be activated again. If you ever wish to pause this feature again, it's easy to do!"}
+
+
+
setPauseResumeAttendance(false)}
+ className="bg-neutral-600/80 dark:bg-neutral-600 hover:bg-neutral-600/75 h-[1.9rem] xmd:h-[2.15rem] px-3 xmd:px-4 rounded-[4px]"
+ >
+ Cancel
+
+
{
+ !loadingPRTeamAttendance &&
+ pauseAndResumeTeamAttendance({
+ variables: {
+ team: selectedTeamId,
+ orgToken: localStorage.getItem('orgToken'),
+ },
+ });
+ }}
+ disabled={loadingPRTeamAttendance}
+ className="bg-primary hover:bg-primary/75 h-[1.9rem] xmd:h-[2.15rem] w-20 xmd:w-[5.4rem] rounded-[4px]"
+ >
+ {!loadingPRTeamAttendance ? (
+ Confirm
+ ) : (
+
+ )}
+
+
+
-
- {selectedTeamData?.isJobActive
- ? "By confirming, automatic attendance week additions for upcoming weeks will be paused. You can still record attendance for the current week. Don't worry you can reactivate this feature at any time!."
- : "By confirming, automatic attendance week additions for upcoming weeks will be activated again. If you ever wish to pause this feature again, it's easy to do!"}
-
-
-
setPauseResumeAttendance(false)}
- className="bg-neutral-600/80 dark:bg-neutral-600 hover:bg-neutral-600/75 h-[1.9rem] xmd:h-[2.15rem] px-3 xmd:px-4 rounded-[4px]"
- >
- Cancel
-
-
{
- !loadingPRTeamAttendance &&
- pauseAndResumeTeamAttendance({
- variables: {
- team: selectedTeamId,
- orgToken: localStorage.getItem('orgToken'),
- },
- });
- }}
- disabled={loadingPRTeamAttendance}
- className="bg-primary hover:bg-primary/75 h-[1.9rem] xmd:h-[2.15rem] w-20 xmd:w-[5.4rem] rounded-[4px]"
- >
- {!loadingPRTeamAttendance ? (
- Confirm
- ) : (
-
-
+ )}
+
+
+
+
{t('Attendance')}
+
+
+
+
+ Team
+
+
+ {
+ if (
+ isUpdatedMode &&
+ selectedTeamId !== event.target.value.toString() &&
+ updated
+ ) {
+ toast.warning(
+ 'First Discard or Update your changes',
+ {
+ style: { color: '#000', lineHeight: '.95rem' },
+ },
+ );
+ return;
+ }
+ setSelectedPhase(undefined);
+ setIsUpdatedMode(false);
+ setSelectedTeamId(event.target.value.toString());
+ const teamData = teamsData?.find(
+ (team) => team.id === event.target.value.toString(),
+ );
+ setSelectedTeamData(teamData);
+ }}
+ >
+ {teamsData?.length &&
+ teamsData.map((teamData) => (
+
+ {teamData.name}
+
+ ))}
+ {!teamLoading && !teamsData?.length && (
+
+ No teams
+
+ )}
+
- )}
-
-
-
-
- )}
-
-
-
-
{t('Attendance')}
-
-
-
-
- Team
-
-
- {
- if (
- isUpdatedMode &&
- selectedTeamId !== event.target.value.toString() &&
- updated
- ) {
- toast.warning('First Discard or Update your changes', {
- style: { color: '#000', lineHeight: '.95rem' },
- });
- return;
- }
- setSelectedPhase(undefined);
- setIsUpdatedMode(false);
- setSelectedTeamId(event.target.value.toString());
- const teamData = teamsData?.find(
- (team) => team.id === event.target.value.toString(),
- );
- setSelectedTeamData(teamData);
- }}
+
+
- {teamsData?.length &&
- teamsData.map((teamData) => (
-
- {teamData.name}
-
- ))}
- {!teamLoading && !teamsData?.length && (
-
- No teams
-
- )}
-
+ {!teamsLoading ? t('Submit Attendance') : 'Loading...'}
+
-
-
- {!teamsLoading ? t('Submit Attendance') : 'Loading...'}
-
-
-
-
- {phases.map((phase, index) => (
-
{
- if (isUpdatedMode && selectedPhase !== phase && updated) {
- toast.warning('First Discard or Update your changes', {
- style: { color: '#000', lineHeight: '.95rem' },
- });
- return;
- }
- setIsUpdatedMode(false);
- setSelectedPhase(phase);
- }}
- >
- {phase.name}
-
- ))}
-
-
-
Week:
-
{
- if (
- isUpdatedMode &&
- selectedWeek !== Number(event.target.value) &&
- updated
- ) {
- toast.warning('First Discard or Update your changes', {
- style: { color: '#000', lineHeight: '.95rem' },
- });
- return;
- }
- setIsUpdatedMode(false);
- setSelectedWeek(Number(event.target.value));
- }}
- >
- {weeks.length &&
- weeks.map((week) => (
-
- {week}
-
+
+
+ {phases.map((phase, index) => (
+
{
+ if (
+ isUpdatedMode &&
+ selectedPhase !== phase &&
+ updated
+ ) {
+ toast.warning(
+ 'First Discard or Update your changes',
+ {
+ style: { color: '#000', lineHeight: '.95rem' },
+ },
+ );
+ return;
+ }
+ setIsUpdatedMode(false);
+ setSelectedPhase(phase);
+ }}
+ >
+ {phase.name}
+
))}
-
-
-
-
-
- {['mon', 'tue', 'wed', 'thu', 'fri'].map((day, index) => (
-
{
- if (isUpdatedMode && selectedDay !== day && updated) {
- toast.warning('First Discard or Update your changes', {
- style: { color: '#000', lineHeight: '.95rem' },
- });
- return;
- }
- setIsUpdatedMode(false);
- setSelectedDay(day as 'mon' | 'tue' | 'wed' | 'thu' | 'fri');
- }}
- data-testid="days-test"
- >
- {day}
-
- ))}
-
-
-
-
- {selectedDayDate && (
- <>
-
-
- {selectedDayDate}
-
- >
- )}
-
-
-
{
- if (!selectedDayHasData) {
- return toast.warning(
- 'You cannot update attendance for the day without any entries.',
- { style: { color: '#000', lineHeight: '.95rem' } },
- );
- }
- return setIsUpdatedMode(true);
- }}
- data-testid="update-link"
- >
-
-
{
- if (isUpdatedMode) {
- toast.warning(
- 'You cannot delete the attendance while it is being updated.',
- { style: { color: '#000', lineHeight: '.95rem' } },
- );
- return;
- }
- handleDeleteAttendance();
- }}
- className="flex gap-x-1 items-center cursor-pointer"
- >
-
-
-
{
- setPauseResumeAttendance(true);
- }}
- className="flex gap-x-[5px] items-center cursor-pointer"
- >
- {selectedTeamData?.isJobActive ? (
-
- ) : (
-
- )}
+
+ Week:
+ {
+ if (
+ isUpdatedMode &&
+ selectedWeek !== Number(event.target.value) &&
+ updated
+ ) {
+ toast.warning('First Discard or Update your changes', {
+ style: { color: '#000', lineHeight: '.95rem' },
+ });
+ return;
+ }
+ setIsUpdatedMode(false);
+ setSelectedWeek(Number(event.target.value));
+ }}
+ >
+ {weeks.length &&
+ weeks.map((week) => (
+
+ {week}
+
+ ))}
+
-
-
-
-
-
-
+ {['mon', 'tue', 'wed', 'thu', 'fri'].map((day, index) => (
+ {
+ if (isUpdatedMode && selectedDay !== day && updated) {
+ toast.warning('First Discard or Update your changes', {
+ style: { color: '#000', lineHeight: '.95rem' },
+ });
+ return;
+ }
+ setIsUpdatedMode(false);
+ setSelectedDay(
+ day as 'mon' | 'tue' | 'wed' | 'thu' | 'fri',
+ );
+ }}
+ data-testid="days-test"
+ >
+ {day}
+
+ ))}
+
+
+
+
+ {selectedDayDate && (
+ <>
+
+
+ {selectedDayDate}
+
+ >
+ )}
+
+
+
{
+ if (!selectedDayHasData) {
+ return toast.warning(
+ 'You cannot update attendance for the day without any entries.',
+ { style: { color: '#000', lineHeight: '.95rem' } },
+ );
+ }
+ return setIsUpdatedMode(true);
+ }}
+ data-testid="update-link"
>
- Names
-
-
+
+ {
+ if (isUpdatedMode) {
+ toast.warning(
+ 'You cannot delete the attendance while it is being updated.',
+ { style: { color: '#000', lineHeight: '.95rem' } },
+ );
+ return;
+ }
+ handleDeleteAttendance();
+ }}
+ className="flex gap-x-1 items-center cursor-pointer"
>
- Email
-
-
+
+ {
+ setPauseResumeAttendance(true);
+ }}
+ className="flex gap-x-[5px] items-center cursor-pointer"
>
- Score
-
- {isUpdatedMode && (
-
- Action
-
- )}
-
-
-
- {!teamAttendanceLoading &&
- traineeAttendanceData.length > 0 &&
- traineeAttendanceData.map((attendanceData) => {
- if (
- attendanceData.phase.id === selectedPhase?.id &&
- attendanceData.week === selectedWeek &&
- attendanceData.days[selectedDay].length
- ) {
- return attendanceData.days[selectedDay].map(
- (dayData, index) => (
-
-
- {
- // eslint-disable-next-line no-nested-ternary
- window.innerWidth < 520 &&
- dayData.trainee.profile.name.length > 16
- ? `${dayData.trainee.profile.name.slice(
- 0,
- 16,
- )}..`
- : dayData.trainee.profile.name
- }
-
-
- {
- // eslint-disable-next-line no-nested-ternary
- window.innerWidth < 600 &&
- dayData.trainee.email.length > 20
- ? window.innerWidth > 530
- ? `${dayData.trainee.email.slice(
- 0,
- 22,
- )}..`
- : `${dayData.trainee.email.slice(
- 0,
- 16,
- )}..`
- : dayData.trainee.email
- }
-
- {
- // eslint-disable-next-line jsx-a11y/control-has-associated-label
-
-
-
- }
- {isUpdatedMode && (
- // eslint-disable-next-line jsx-a11y/control-has-associated-label
-
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+ Names
+
+
+ Email
+
+
+ Score
+
+ {isUpdatedMode && (
+
+ Action
+
+ )}
+
+
+
+ {!teamAttendanceLoading &&
+ traineeAttendanceData.length > 0 &&
+ traineeAttendanceData.map((attendanceData) => {
+ if (
+ attendanceData.phase.id === selectedPhase?.id &&
+ attendanceData.week === selectedWeek &&
+ attendanceData.days[selectedDay].length
+ ) {
+ return attendanceData.days[selectedDay].map(
+ (dayData, index) => (
+
-
+ {
+ // eslint-disable-next-line no-nested-ternary
+ window.innerWidth < 520 &&
+ dayData.trainee.profile.name.length > 16
+ ? `${dayData.trainee.profile.name.slice(
+ 0,
+ 16,
+ )}..`
+ : dayData.trainee.profile.name
+ }
+
+
+ {
+ // eslint-disable-next-line no-nested-ternary
+ window.innerWidth < 600 &&
+ dayData.trainee.email.length > 20
+ ? window.innerWidth > 530
+ ? `${dayData.trainee.email.slice(
+ 0,
+ 22,
+ )}..`
+ : `${dayData.trainee.email.slice(
+ 0,
+ 16,
+ )}..`
+ : dayData.trainee.email
}
- setUpdated={setUpdate}
- />
+
+ {
+ // eslint-disable-next-line jsx-a11y/control-has-associated-label
+
+
+
+ }
+ {isUpdatedMode && (
+ // eslint-disable-next-line jsx-a11y/control-has-associated-label
+
+
+
+ )}
+
+ ),
+ );
+ }
+ if (
+ traineeAttendanceData.length > 0 &&
+ attendanceData.phase.id === selectedPhase?.id &&
+ attendanceData.week === selectedWeek &&
+ !attendanceData.days[selectedDay].length
+ ) {
+ return (
+
+
+ There is no attendance for the selected day
- )}
-
- ),
- );
- }
- if (
- traineeAttendanceData.length > 0 &&
- attendanceData.phase.id === selectedPhase?.id &&
- attendanceData.week === selectedWeek &&
- !attendanceData.days[selectedDay].length
- ) {
- return (
-
+
+ );
+ }
+ return null;
+ })}
+ {(teamsLoading || teamAttendanceLoading) && (
+
+
+ Loading Data...
+
+
+ )}
+ {!teamsLoading &&
+ !teamAttendanceLoading &&
+ !traineeAttendanceData.length && (
+
There is no attendance for the selected day
+ )}
+
+
+
+ {isUpdatedMode && (
+
+
{
+ setUpdate(false);
+ setTraineeAttendanceData(initialTraineeAttendanceData);
+ setIsUpdatedMode(false);
+ }}
+ data-testid="cancel-button"
+ >
+ Cancel
+
+
{
+ if (updated) {
+ handleUpdateAttendance();
+ }
+ }}
+ data-testid="update-button"
+ >
+ {loadingupdateAttendance ? (
+
+ ) : (
+ 'Update'
+ )}
+
+
+ )}
+
+
+
+
+
ATTENDANCE ACTIONS
+
{
+ if (!selectedDayHasData) {
+ return toast.warning(
+ 'You cannot update attendance for the day without any entries.',
+ { style: { color: '#000', lineHeight: '.95rem' } },
);
}
- return null;
- })}
- {(teamsLoading || teamAttendanceLoading) && (
-
-
- Loading Data...
-
-
- )}
- {!teamsLoading &&
- !teamAttendanceLoading &&
- !traineeAttendanceData.length && (
-
-
- There is no attendance for the selected day
-
-
+ return setIsUpdatedMode(true);
+ }}
+ data-testid="update-link-2"
+ >
+
+ Update Attendance ({selectedDay})
+
+
{
+ if (isUpdatedMode) {
+ toast.warning(
+ 'You cannot delete the attendance while it is being updated.',
+ { style: { color: '#000', lineHeight: '.95rem' } },
+ );
+ return;
+ }
+ handleDeleteAttendance();
+ }}
+ className="flex gap-x-1 items-center ml-4 cursor-pointer hover:text-primary font-medium"
+ data-testid="delete-btn-test"
+ >
+
+
+ {loadingDeleteAttendance
+ ? 'Deleting Attendance ...'
+ : `Delete Attendance (${selectedDay})`}
+
+
+
{
+ setPauseResumeAttendance(true);
+ }}
+ className="flex gap-x-[5px] items-center ml-4 cursor-pointer hover:text-primary font-medium leading-3"
+ >
+ {selectedTeamData?.isJobActive ? (
+
+ ) : (
+
)}
-
-
-
- {isUpdatedMode && (
-
-
{
- setUpdate(false);
- setTraineeAttendanceData(initialTraineeAttendanceData);
- setIsUpdatedMode(false);
- }}
- data-testid="cancel-button"
- >
- Cancel
-
-
{
- if (updated) {
- handleUpdateAttendance();
- }
- }}
- data-testid="update-button"
- >
- {loadingupdateAttendance ? (
-
- ) : (
- 'Update'
- )}
-
-
- )}
-
-
-
-
-
ATTENDANCE ACTIONS
-
{
- if (!selectedDayHasData) {
- return toast.warning(
- 'You cannot update attendance for the day without any entries.',
- { style: { color: '#000', lineHeight: '.95rem' } },
- );
- }
- return setIsUpdatedMode(true);
- }}
- data-testid="update-link-2"
- >
-
- Update Attendance ({selectedDay})
-
-
{
- if (isUpdatedMode) {
- toast.warning(
- 'You cannot delete the attendance while it is being updated.',
- { style: { color: '#000', lineHeight: '.95rem' } },
- );
- return;
- }
- handleDeleteAttendance();
- }}
- className="flex gap-x-1 items-center ml-4 cursor-pointer hover:text-primary font-medium"
- data-testid="delete-btn-test"
- >
-
-
- {loadingDeleteAttendance
- ? 'Deleting Attendance ...'
- : `Delete Attendance (${selectedDay})`}
-
-
-
{
- setPauseResumeAttendance(true);
- }}
- className="flex gap-x-[5px] items-center ml-4 cursor-pointer hover:text-primary font-medium leading-3"
- >
- {selectedTeamData?.isJobActive ? (
-
- ) : (
-
- )}
-
- {selectedTeamData?.isJobActive
- ? 'Pause Attendance'
- : 'Resume Attendance'}
-
-
-
-
-
-
-
[2] Attended and communicated
-
-
-
-
[1] Didn‘t attend and communicated
-
-
-
-
- [0] Didn‘t attend and didn‘t communicate
-
+
+ {selectedTeamData?.isJobActive
+ ? 'Pause Attendance'
+ : 'Resume Attendance'}
+
+
+
+
+
+
+
[2] Attended and communicated
+
+
+
+
[1] Didn‘t attend and communicated
+
+
+
+
+ [0] Didn‘t attend and didn‘t communicate
+
+
+
-
-
+ >
+ )}
);
}
diff --git a/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap b/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap
index 8eb69ae1b..aacd978b6 100644
--- a/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap
+++ b/tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap
@@ -463,7 +463,7 @@ Array [
name="date"
readOnly={true}
type="text"
- value="2024-11-19"
+ value="2024-11-21"
/>
+ className="animate-pulse font-serif font-lexend w-[550px] h-[300px] md:w-[550px] md:h-[300px] rounded-md px-3 md:p-10 mr-11 py-7 bg-gray-300"
+ >
+
+
+
+
+
`;
diff --git a/tests/pages/TraineeAttendanceTracker.test.tsx b/tests/pages/TraineeAttendanceTracker.test.tsx
index 0b4861e33..d1fa4e988 100644
--- a/tests/pages/TraineeAttendanceTracker.test.tsx
+++ b/tests/pages/TraineeAttendanceTracker.test.tsx
@@ -330,231 +330,4 @@ describe('CRUD Of Trainee Attendance', () => {
.toJSON();
expect(elem).toMatchSnapshot();
});
- it('Renders the TraineeAttendance Page', async () => {
- jest.spyOn(React, 'useContext').mockImplementation(() => ({
- user: {
- role: 'ttl',
- },
- }));
- render(
-
-
- ,
- );
-
- expect(await screen.findByText('Loading Data...')).toBeInTheDocument();
-
- const teamElement = await screen.findByTestId('team-test');
- expect(teamElement).toBeInTheDocument();
-
- fireEvent.change(teamElement, {
- target: { value: 'Team-I-id-123' },
- });
-
- const weeksElement = await screen.findByTestId('week-test');
- expect(weeksElement).toBeInTheDocument();
-
- const updateLink2 = screen.getByTestId('update-link-2');
- expect(updateLink2).toBeInTheDocument();
-
- const phase1Element = await screen.findByText('Phase I');
- expect(phase1Element).toBeInTheDocument();
-
- fireEvent.click(phase1Element);
-
- const phase2Element = await screen.findByText('Phase II');
- expect(phase2Element).toBeInTheDocument();
-
- fireEvent.change(weeksElement, { target: { value: '2' } });
- fireEvent.change(weeksElement, { target: { value: '1' } });
-
- const daysElement = screen.getAllByTestId('days-test');
- expect(daysElement).toHaveLength(5);
- daysElement.forEach((element) => {
- fireEvent.click(element);
- });
- fireEvent.click(daysElement[0]);
-
- // Back to Phase I
- fireEvent.click(phase1Element);
-
- // Find row with trainee name test-trainee-name
- expect(await screen.findByText('test-trainee-name')).toBeInTheDocument();
-
- fireEvent.click(updateLink2);
-
- const cancelButton = await screen.findByTestId('cancel-button');
- expect(cancelButton).toBeInTheDocument();
- fireEvent.click(cancelButton);
-
- fireEvent.click(updateLink2);
-
- const deleteBtn = await screen.findByTestId('delete-btn-test');
- expect(deleteBtn).toBeInTheDocument();
-
- fireEvent.click(deleteBtn);
-
- expect(toast.warning).toHaveBeenCalledWith(
- 'You cannot delete the attendance while it is being updated.',
- { style: { color: '#000', lineHeight: '.95rem' } },
- );
-
- const editButton = await screen.findAllByTestId('edit-button');
- expect(editButton).toHaveLength(2);
-
- fireEvent.click(editButton[0]);
-
- const zeroScore = await screen.findByTestId('score-0');
- expect(zeroScore).toBeInTheDocument();
- fireEvent.click(zeroScore);
-
- await fireEvent.click(phase2Element);
-
- expect(toast.warning).toHaveBeenCalledWith(
- 'First Discard or Update your changes',
- expect.objectContaining({
- style: { color: '#000', lineHeight: '.95rem' },
- }),
- );
-
- fireEvent.click(daysElement[1]);
-
- expect(toast.warning).toHaveBeenCalledWith(
- 'First Discard or Update your changes',
- expect.objectContaining({
- style: { color: '#000', lineHeight: '.95rem' },
- }),
- );
-
- fireEvent.change(weeksElement, { target: { value: '2' } });
-
- expect(toast.warning).toHaveBeenCalledWith(
- 'First Discard or Update your changes',
- expect.objectContaining({
- style: { color: '#000', lineHeight: '.95rem' },
- }),
- );
- });
- it("Doesn't Delete attendance Test for day without entries", async () => {
- await cleanup();
- jest.spyOn(React, 'useContext').mockImplementation(() => ({
- user: {
- role: 'coordinator',
- },
- }));
- render(
-
-
- ,
- );
-
- const teamElement = await screen.findByTestId('team-test');
- expect(teamElement).toBeInTheDocument();
-
- fireEvent.change(teamElement, {
- target: { value: '66eea29cba07ede8a49e8bc6' },
- });
-
- expect(await screen.findByText('Loading Data...')).toBeInTheDocument();
-
- const phase1Element = await screen.findByText('Phase I');
- expect(phase1Element).toBeInTheDocument();
-
- fireEvent.click(phase1Element);
-
- const weeksElement = await screen.findByTestId('week-test');
- expect(weeksElement).toBeInTheDocument();
-
- const updateLink2 = screen.getByTestId('update-link-2');
- expect(updateLink2).toBeInTheDocument();
-
- expect(await screen.findByText('test-trainee-name')).toBeInTheDocument();
-
- fireEvent.change(weeksElement, { target: { value: '2' } });
- fireEvent.change(weeksElement, { target: { value: '1' } });
-
- const phase2Element = await screen.findByText('Phase II');
- expect(phase2Element).toBeInTheDocument();
- fireEvent.click(phase2Element);
-
- const daysElement = screen.getAllByTestId('days-test');
-
- fireEvent.click(daysElement[4]);
-
- const deleteBtn = await screen.findByTestId('delete-btn-test');
- expect(deleteBtn).toBeInTheDocument();
-
- fireEvent.click(deleteBtn);
- });
- it('Pause attendance for team with active attendance', async () => {
- await cleanup();
- jest.spyOn(React, 'useContext').mockImplementation(() => ({
- user: {
- role: 'coordinator',
- },
- }));
-
- render(
-
-
- ,
- );
-
- expect(await screen.findByText('Loading Data...')).toBeInTheDocument();
-
- const teamElement = await screen.findByTestId('team-test');
- expect(teamElement).toBeInTheDocument();
-
- fireEvent.change(teamElement, {
- target: { value: 'Team-I-id-123' },
- });
-
- const pauseAttendanceElement = await screen.findByText('Pause Attendance');
- expect(pauseAttendanceElement).toBeInTheDocument();
-
- fireEvent.click(pauseAttendanceElement);
-
- const cancelBtn = screen.getByText('Cancel');
- expect(cancelBtn).toBeInTheDocument();
- fireEvent.click(cancelBtn);
- });
- it('Resume attendance for team with inactive attendance', async () => {
- await cleanup();
- jest.spyOn(React, 'useContext').mockImplementation(() => ({
- user: {
- role: 'coordinator',
- },
- }));
-
- mocks[0].result.data.getAllTeams![0].isJobActive = false;
-
- render(
-
-
- ,
- );
-
- expect(await screen.findByText('Loading Data...')).toBeInTheDocument();
-
- const teamElement = await screen.findByTestId('team-test');
- expect(teamElement).toBeInTheDocument();
-
- fireEvent.change(teamElement, {
- target: { value: 'Team-I-id-123' },
- });
-
- const phase1Element = await screen.findByText('Phase I');
- expect(phase1Element).toBeInTheDocument();
-
- const resumeAttendanceElement = await screen.findByText(
- 'Resume Attendance',
- );
- expect(resumeAttendanceElement).toBeInTheDocument();
-
- fireEvent.click(resumeAttendanceElement);
-
- const confirmBtn = screen.getByText('Confirm');
- expect(confirmBtn).toBeInTheDocument();
- fireEvent.click(confirmBtn);
- });
});
diff --git a/tests/pages/__snapshots__/AdminTraineeDashboard.test.tsx.snap b/tests/pages/__snapshots__/AdminTraineeDashboard.test.tsx.snap
index 9034f8cdd..f213b3cf8 100644
--- a/tests/pages/__snapshots__/AdminTraineeDashboard.test.tsx.snap
+++ b/tests/pages/__snapshots__/AdminTraineeDashboard.test.tsx.snap
@@ -463,7 +463,7 @@ Array [
name="date"
readOnly={true}
type="text"
- value="2024-11-19"
+ value="2024-11-21"
/>