Skip to content

Commit

Permalink
Fix Empty Syphilis Symptoms View (#8051)
Browse files Browse the repository at this point in the history
* add more generic symptom typing and update function contracts

* add syphilis symptom specific test

* programatically generate allSymptomsMap
  • Loading branch information
bobbywells52 authored Aug 22, 2024
1 parent d75971c commit a352b9e
Show file tree
Hide file tree
Showing 4 changed files with 426 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ hivTestResult.results = [
hivTestResult.genderOfSexualPartners = ["female", "male", "other"];
hivTestResult.pregnancy = "77386006";

const syphilisTestResult = JSON.parse(JSON.stringify(nonMultiplexTestResult));
syphilisTestResult.results = [
{
disease: { name: "Syphilis" as MultiplexDisease },
testResult: "POSITIVE" as TestResult,
__typename: "MultiplexResult",
},
];
syphilisTestResult.pregnancy = "77386006";
syphilisTestResult.symptoms = '{"266128007":"true"}';

const renderComponent = (testResult: TestResult) =>
render(
<DetachedTestResultDetailsModal
Expand Down Expand Up @@ -152,3 +163,25 @@ describe("HIV TestResultDetailsModal", () => {
expect(view).toMatchSnapshot();
});
});

describe("Syphilis TestResultDetailsModal", () => {
beforeEach(() => {
ReactDOM.createPortal = jest.fn((element, _node) => {
return element;
}) as any;
});

it("should have Syphilis specific symptoms", () => {
renderComponent(syphilisTestResult);
expect(screen.getByText("Syphilis result")).toBeInTheDocument();
expect(screen.getByText("Symptoms")).toBeInTheDocument();
expect(screen.getByText("Symptom onset")).toBeInTheDocument();
expect(screen.getByText("Body Rash")).toBeInTheDocument();
expect(screen.getByText("Pregnant?")).toBeInTheDocument();
});

it("matches screenshot", () => {
let view = renderComponent(syphilisTestResult);
expect(view).toMatchSnapshot();
});
});
Loading

0 comments on commit a352b9e

Please sign in to comment.