Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hotfix to post-submit page for new ida #157

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/instructions/Instructions.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,29 @@ describe('SequenceExamWrapper', () => {
}
});

it('Shows correct rejected practice exam instructions when attempt is rejected', () => {
store.getState = () => ({
specialExams: Factory.build('specialExams', {
exam: Factory.build('exam', {
is_proctored: true,
type: ExamType.PRACTICE,
attempt: Factory.build('attempt', {
attempt_status: ExamStatus.REJECTED,
}),
}),
}),
});

const { queryByTestId } = render(
<Instructions>
<div>Sequence</div>
</Instructions>,
{ store },
);

expect(queryByTestId('proctored-exam-instructions-title')).toBeInTheDocument();
});

it('Shows submit onboarding exam instructions if exam is onboarding and attempt status is ready_to_submit', () => {
store.getState = () => ({
specialExams: Factory.build('specialExams', {
Expand Down Expand Up @@ -477,6 +500,34 @@ describe('SequenceExamWrapper', () => {
expect(screen.getByRole('link', { name: '[email protected]' })).toHaveTextContent('[email protected]');
});

it('Shows verified practice exam instructions if exam is practice and attempt status is verified', () => {
store.getState = () => ({
specialExams: Factory.build('specialExams', {
proctoringSettings: Factory.build('proctoringSettings', {
integration_specific_email: '[email protected]',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
type: ExamType.PRACTICE,
attempt: Factory.build('attempt', {
attempt_status: ExamStatus.VERIFIED,
}),
}),
}),
});

render(
<Instructions>
<div>Sequence</div>
</Instructions>,
{ store },
);

expect(screen.getByText('Your proctoring session was reviewed successfully. A final grade will be available soon.')).toBeInTheDocument();
expect(screen.getByTestId('proctored-exam-instructions-title')).toBeInTheDocument();
});

it('Shows error practice exam instructions if exam is onboarding and attempt status is error', () => {
store.getState = () => ({
specialExams: Factory.build('specialExams', {
Expand Down
2 changes: 2 additions & 0 deletions src/instructions/RejectedInstructions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const RejectedExamInstructions = ({ examType }) => {
switch (examType) {
case ExamType.PROCTORED:
return <RejectedProctoredExamInstructions />;
case ExamType.PRACTICE:
return <RejectedProctoredExamInstructions />;
case ExamType.ONBOARDING:
return <RejectedOnboardingExamInstructions />;
default:
Expand Down
6 changes: 4 additions & 2 deletions src/instructions/VerifiedInstructions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import Footer from './proctored_exam/Footer';
const VerifiedExamInstructions = ({ examType }) => {
const renderInstructions = () => {
switch (examType) {
case ExamType.ONBOARDING:
return <VerifiedOnboardingExamInstructions />;
case ExamType.PROCTORED:
return <VerifiedProctoredExamInstructions />;
case ExamType.PRACTICE:
return <VerifiedProctoredExamInstructions />;
Comment on lines 12 to +15
Copy link
Member

@rijuma rijuma Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Just for clarity, this could be written as:

Suggested change
case ExamType.PROCTORED:
return <VerifiedProctoredExamInstructions />;
case ExamType.PRACTICE:
return <VerifiedProctoredExamInstructions />;
case ExamType.PRACTICE:
case ExamType.PROCTORED:
return <VerifiedProctoredExamInstructions />;

case ExamType.ONBOARDING:
return <VerifiedOnboardingExamInstructions />;
default:
return null;
}
Expand Down
Loading