From 71cbd6a1462577291ef0be901a4240c0c02407f1 Mon Sep 17 00:00:00 2001 From: palagdan Date: Thu, 30 Oct 2025 13:32:06 +0100 Subject: [PATCH 1/2] [#302] Support optional institution column --- src/components/record/RecordRow.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/record/RecordRow.jsx b/src/components/record/RecordRow.jsx index d6213331..72ddaf78 100644 --- a/src/components/record/RecordRow.jsx +++ b/src/components/record/RecordRow.jsx @@ -72,13 +72,13 @@ const RecordRow = (props) => { {`${record.author.firstName} ${record.author.lastName}`} ) : ( - Not Found + "—" )} )} {props.visibleColumns.includes(COLUMNS.INSTITUTION) && ( - {record.institution.name} + {record.institution ? record.institution.name : "—"} )} {props.visibleColumns.includes(COLUMNS.TEMPLATE) && ( From 48bfeaf5a75c6c1366b5f15e25f3467030163cfe Mon Sep 17 00:00:00 2001 From: palagdan Date: Thu, 30 Oct 2025 14:00:44 +0100 Subject: [PATCH 2/2] [#302] Fix and implement new tests --- tests/__tests__/components/RecordRow.spec.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/__tests__/components/RecordRow.spec.jsx b/tests/__tests__/components/RecordRow.spec.jsx index ef97a390..fb0f6597 100644 --- a/tests/__tests__/components/RecordRow.spec.jsx +++ b/tests/__tests__/components/RecordRow.spec.jsx @@ -85,9 +85,9 @@ describe("RecordRow", function () { expect(screen.queryByText("Thomas Shelby")).not.toBeInTheDocument(); }); - it("renders 'Not Found' for author if firstName or lastName are missing", () => { + it("renders '—' for author if firstName or lastName are missing", () => { renderComponent({ record: { ...defaultProps.record, author: { username: "Thomas" } } }); - expect(screen.getByText("Not Found")).toBeInTheDocument(); + expect(screen.getByText("—")).toBeInTheDocument(); }); it("renders institution if it is visible", () => { @@ -95,6 +95,11 @@ describe("RecordRow", function () { expect(screen.getByText(defaultProps.record.institution.name)).toBeInTheDocument(); }); + it("renders '—' for institution if it is missing", () => { + renderComponent({ record: { ...defaultProps.record, institution: null } }); + expect(screen.getByText("—")).toBeInTheDocument(); + }); + it("does not render institution if it is not visible", () => { renderComponent({ visibleColumns: Object.values(COLUMNS).filter((col) => col !== COLUMNS.INSTITUTION) }); expect(screen.queryByText(defaultProps.record.institution.name)).not.toBeInTheDocument();