From b5fce7d3075fdfac3c18aeaaa2880f8c0ed93b0d Mon Sep 17 00:00:00 2001 From: michaelroytman Date: Thu, 1 Feb 2024 14:30:04 -0500 Subject: [PATCH] test: remove references to ExamStateProvider from tests for instructions components This commit removes references to the ExamStateProvider from tests for instructions components. Because these components have been refactored to no longe rely on the ExamStateProvider, they are not required in the component tree. --- src/instructions/Instructions.test.jsx | 265 +++++++----------- .../ProctoredExamInstructions.test.jsx | 81 ++---- 2 files changed, 129 insertions(+), 217 deletions(-) diff --git a/src/instructions/Instructions.test.jsx b/src/instructions/Instructions.test.jsx index 00157585..af9a5200 100644 --- a/src/instructions/Instructions.test.jsx +++ b/src/instructions/Instructions.test.jsx @@ -12,7 +12,6 @@ import { TIMER_REACHED_NULL } from '../timer/events'; import { render, screen, act, initializeMockApp, } from '../setupTest'; -import ExamStateProvider from '../core/ExamStateProvider'; import { ExamStatus, ExamType, INCOMPLETE_STATUSES, } from '../constants'; @@ -48,11 +47,9 @@ describe('SequenceExamWrapper', () => { store.getState = () => ({ specialExams: Factory.build('specialExams') }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('start-exam-button')).toHaveTextContent('I am ready to start this timed exam.'); @@ -71,11 +68,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('sequence-content')).toHaveTextContent('Sequence'); @@ -100,11 +95,9 @@ describe('SequenceExamWrapper', () => { }); const { queryByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -135,11 +128,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('exam-instructions-title')).toHaveTextContent('Try a proctored exam'); @@ -167,11 +158,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -204,11 +193,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -231,11 +218,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(screen.getByText('Error with proctored exam')).toBeInTheDocument(); @@ -256,11 +241,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(screen.getByText('Your exam is ready to be resumed.')).toBeInTheDocument(); @@ -282,11 +265,9 @@ describe('SequenceExamWrapper', () => { }); const { queryByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -319,11 +300,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('exam.submittedExamInstructions.title')).toHaveTextContent('You have submitted your timed exam.'); @@ -342,11 +321,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('exam.submittedExamInstructions.title')).toHaveTextContent('The time allotted for this exam has expired.'); @@ -369,11 +346,9 @@ describe('SequenceExamWrapper', () => { }); const { queryByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -402,11 +377,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -428,11 +401,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -459,11 +430,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -496,11 +465,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -523,11 +490,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -550,11 +515,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -575,11 +538,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -600,11 +561,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -631,11 +590,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -660,11 +617,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
children
-
-
, + +
children
+
, { store }, ); @@ -687,11 +642,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
children
-
-
, + +
children
+
, { store }, ); @@ -713,11 +666,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -744,11 +695,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -782,11 +731,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -819,11 +766,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -862,11 +807,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); fireEvent.click(screen.getByText('Start System Check')); @@ -912,11 +855,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -952,11 +893,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(screen.getByDisplayValue('1234-5678-9012-3456')).toBeInTheDocument(); @@ -979,11 +918,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
children
-
-
, + +
children
+
, { store }, ); @@ -1005,11 +942,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -1032,11 +967,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); diff --git a/src/instructions/proctored_exam/ProctoredExamInstructions.test.jsx b/src/instructions/proctored_exam/ProctoredExamInstructions.test.jsx index 07e07151..df3d1023 100644 --- a/src/instructions/proctored_exam/ProctoredExamInstructions.test.jsx +++ b/src/instructions/proctored_exam/ProctoredExamInstructions.test.jsx @@ -5,7 +5,6 @@ import { fireEvent, waitFor } from '@testing-library/dom'; import Instructions from '../index'; import { store, getExamAttemptsData, submitExam } from '../../data'; import { initializeMockApp, render, screen } from '../../setupTest'; -import ExamStateProvider from '../../core/ExamStateProvider'; import { ExamType, ExamStatus, @@ -42,11 +41,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('start-exam-button')).toHaveTextContent('Continue to my proctored exam.'); @@ -74,11 +71,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('sequence-content')).toHaveTextContent('Sequence'); @@ -99,11 +94,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(screen.getByTestId('proctored-exam-instructions-rulesLink')).toHaveTextContent('Rules for Online Proctored Exams'); @@ -128,11 +121,9 @@ describe('SequenceExamWrapper', () => { }); render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(screen.getByTestId('proctored-exam-instructions-rulesLink')).toHaveTextContent('Rules for Online Proctored Exams'); @@ -154,11 +145,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('proctored-exam-instructions-title')).toHaveTextContent('You have submitted this proctored exam for review'); @@ -181,11 +170,9 @@ describe('SequenceExamWrapper', () => { }); const { queryByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -218,11 +205,9 @@ describe('SequenceExamWrapper', () => { }); const { queryByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); @@ -248,11 +233,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('proctored-exam-instructions-title')).toHaveTextContent('Your proctoring session was reviewed successfully.'); @@ -272,11 +255,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, ); expect(getByTestId('proctored-exam-instructions-title')) @@ -297,11 +278,9 @@ describe('SequenceExamWrapper', () => { }); const { getByTestId } = render( - - -
Sequence
-
-
, + +
Sequence
+
, { store }, );