Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fzhao99 committed May 17, 2024
1 parent 9488779 commit 8af5ee7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
14 changes: 13 additions & 1 deletion frontend/src/app/testQueue/TestCard/TestCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
generateEditQueueMock,
generateEmptyEditQueueMock,
generateSubmitQueueMock,
blankUpdateAoeEventMock,
} from "../TestCardForm/testUtils/submissionMocks";
import { MULTIPLEX_DISEASES, TEST_RESULTS } from "../../testResults/constants";

Expand Down Expand Up @@ -441,7 +442,9 @@ describe("TestCard", () => {
});

it("renders dropdown of device types", async () => {
const { user } = await renderQueueItem();
const { user } = await renderQueueItem({
mocks: [blankUpdateAoeEventMock],
});

const deviceDropdown = (await screen.findByTestId(
"device-type-dropdown"
Expand Down Expand Up @@ -513,6 +516,7 @@ describe("TestCard", () => {
},
}
),
blankUpdateAoeEventMock,
];

const props = {
Expand Down Expand Up @@ -824,6 +828,8 @@ describe("TestCard", () => {
},
}
),
blankUpdateAoeEventMock,
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand Down Expand Up @@ -976,6 +982,7 @@ describe("TestCard", () => {
},
}
),
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand Down Expand Up @@ -1010,6 +1017,7 @@ describe("TestCard", () => {
MULTIPLEX_DISEASES.COVID_19,
TEST_RESULTS.POSITIVE
),
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand All @@ -1035,6 +1043,7 @@ describe("TestCard", () => {

const mocks = [
generateEditQueueMock(MULTIPLEX_DISEASES.HIV, TEST_RESULTS.POSITIVE),
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand All @@ -1054,6 +1063,7 @@ describe("TestCard", () => {

const mocks = [
generateEditQueueMock(MULTIPLEX_DISEASES.HIV, TEST_RESULTS.POSITIVE),
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand Down Expand Up @@ -1083,6 +1093,7 @@ describe("TestCard", () => {

const mocks = [
generateEditQueueMock(MULTIPLEX_DISEASES.HIV, TEST_RESULTS.UNKNOWN),
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand Down Expand Up @@ -1110,6 +1121,7 @@ describe("TestCard", () => {
MULTIPLEX_DISEASES.COVID_19,
TEST_RESULTS.POSITIVE
),
blankUpdateAoeEventMock,
];

const { user } = await renderQueueItem({ mocks });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ const CovidAoEForm = ({
onSymptomsChange,
onSymptomOnsetDateChange,
} = generateAoeListenerHooks(onResponseChange, responses);
const { hasSymptoms, symptoms } = generateSymptomAoeConstants(
const {
hasSymptoms,
symptoms,
showSymptomOnsetError,
showSymptomOnsetDateError,
} = generateSymptomAoeConstants(
responses,
hasAttemptedSubmit,
respiratorySymptomDefinitions
Expand Down Expand Up @@ -86,6 +91,12 @@ const CovidAoEForm = ({
: ""
}
onChange={(e) => onSymptomOnsetDateChange(e.target.value)}
validationStatus={showSymptomOnsetDateError ? "error" : undefined}
errorMessage={
showSymptomOnsetDateError
? "This question is required if the patient has symptoms."
: undefined
}
></TextInput>
</div>
<div className="grid-row grid-gap">
Expand All @@ -98,6 +109,12 @@ const CovidAoEForm = ({
legend="Select any symptoms the patient is experiencing"
name={`symptoms-${testOrder.internalId}`}
onChange={(e) => onSymptomsChange(e, symptoms)}
validationStatus={showSymptomOnsetError ? "error" : undefined}
errorMessage={
showSymptomOnsetError
? "This question is required if the patient has symptoms."
: undefined
}
/>
</div>
</>
Expand Down

0 comments on commit 8af5ee7

Please sign in to comment.