Skip to content

Commit

Permalink
fix: account for empty lab name (#2942)
Browse files Browse the repository at this point in the history
* fix: account for empty lab name

* test: add test
  • Loading branch information
mcmcgrath13 authored Nov 21, 2024
1 parent 8cd1ce2 commit f91839d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ describe("LabInfo", () => {
evaluate(BundleLab, mappings["diagnosticReports"]),
mappings,
);
// Empty out one of the lab names for testing
labinfoOrg[0].organizationDisplayDataProps[0].value = "";

const labInfoJsx = <LabInfo labResults={labinfoOrg} />;

it("all should be collapsed by default", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,13 @@ exports[`LabInfo should match snapshot test 1`] = `
<div>
<h4
class="usa-summary-box__heading padding-y-105"
id="lab-results-from-providence-st-joseph-medical-center-laboratory-clia-05d0672675"
id="lab-results-from-unknown-organization"
>
Lab Results from PROVIDENCE ST. JOSEPH MEDICAL CENTER LABORATORY (CLIA 05D0672675)
Lab Results from Unknown Organization
</h4>
<div
class="usa-summary-box__text"
>
<div>
<div
class="grid-row"
>
<div
class="data-title padding-right-1"
>
Lab Performing Name
</div>
<div
class="grid-col maxw7 text-pre-line"
>
PROVIDENCE ST. JOSEPH MEDICAL CENTER LABORATORY (CLIA 05D0672675)
</div>
</div>
<div
class="section__line_gray"
/>
</div>
<div>
<div
class="grid-row"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export const LabInfo = ({ labResults }: LabInfoProps): React.JSX.Element => {
? `.acc_item_${labResult.organizationId}`
: "h5";
const labName = `Lab Results from ${
labResult.organizationDisplayDataProps[0].value as string
labResult?.organizationDisplayDataProps?.[0]?.value ||
"Unknown Organization"
}`;
return (
<div key={`${labResult.organizationId}${labIndex}`}>
Expand Down

0 comments on commit f91839d

Please sign in to comment.