From 59ebd9df1a4b607fd9f0588e88a24c82cf2316ff Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Tue, 29 Oct 2024 11:58:28 -0400 Subject: [PATCH] Show Hep C guidance for non-positive results too --- .../HepatitisCResultGuidance.test.tsx | 33 ++----------------- .../HepatitisCResultGuidance.tsx | 12 +------ .../HepatitisCResultGuidance.test.tsx.snap | 2 +- frontend/src/app/utils/testResults.tsx | 2 +- 4 files changed, 6 insertions(+), 43 deletions(-) diff --git a/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.test.tsx b/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.test.tsx index aaf6714c4cc..308ddddbe73 100644 --- a/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.test.tsx +++ b/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.test.tsx @@ -1,40 +1,13 @@ import { render, screen } from "@testing-library/react"; -import { cloneDeep } from "lodash"; import "../../../i18n"; -import { MULTIPLEX_DISEASES, TEST_RESULTS } from "../../testResults/constants"; - import HepatitisCResultGuidance from "./HepatitisCResultGuidance"; describe("HepatitisCResultGuidance", () => { - const mockResultTemplate = { - disease: { - name: MULTIPLEX_DISEASES.HEPATITIS_C, - }, - testResult: TEST_RESULTS.POSITIVE, - } as MultiplexResult; - - it("displays guidance for a positive Hepatitis-C result", () => { - const { container } = render( - - ); + it("displays guidance for a Hepatitis-C result", () => { + const { container } = render(); + expect(screen.getByText("For Hepatitis-C:")).toBeInTheDocument(); expect(container).toMatchSnapshot(); }); - - const nonPositiveCases = [ - TEST_RESULTS.NEGATIVE, - TEST_RESULTS.UNDETERMINED, - TEST_RESULTS.UNKNOWN, - ]; - - test.each(nonPositiveCases)( - "displays no Hepatitis-C guidance for %p result", - (testResult) => { - const mockResult = cloneDeep(mockResultTemplate); - mockResult.testResult = testResult; - render(); - expect(screen.queryByText("For Hepatitis-C:")).not.toBeInTheDocument(); - } - ); }); diff --git a/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.tsx b/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.tsx index 0722318154d..73bfc1f7250 100644 --- a/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.tsx +++ b/frontend/src/app/commonComponents/TestResultGuidance/HepatitisCResultGuidance.tsx @@ -1,11 +1,7 @@ import React from "react"; import { Trans, useTranslation } from "react-i18next"; -import { TEST_RESULTS } from "../../testResults/constants"; - -import { ResultGuidanceProps } from "./ResultsGuidance"; - -const PositiveHepatitisCResultInfo = () => { +const HepatitisCResultGuidance = () => { const { t } = useTranslation(); return ( @@ -32,10 +28,4 @@ const PositiveHepatitisCResultInfo = () => { ); }; -const HepatitisCResultGuidance = ({ result }: ResultGuidanceProps) => { - const hasPositiveHepatitisCResult = - result.testResult === TEST_RESULTS.POSITIVE; - return <>{hasPositiveHepatitisCResult && }; -}; - export default HepatitisCResultGuidance; diff --git a/frontend/src/app/commonComponents/TestResultGuidance/__snapshots__/HepatitisCResultGuidance.test.tsx.snap b/frontend/src/app/commonComponents/TestResultGuidance/__snapshots__/HepatitisCResultGuidance.test.tsx.snap index 6575fe3b5b7..188ea9dc0f5 100644 --- a/frontend/src/app/commonComponents/TestResultGuidance/__snapshots__/HepatitisCResultGuidance.test.tsx.snap +++ b/frontend/src/app/commonComponents/TestResultGuidance/__snapshots__/HepatitisCResultGuidance.test.tsx.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`HepatitisCResultGuidance displays guidance for a positive Hepatitis-C result 1`] = ` +exports[`HepatitisCResultGuidance displays guidance for a Hepatitis-C result 1`] = `

); + guidance.push(); } return guidance;