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) && (
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();