From 26c5da0a4983b3347a90b6e30d037047509f18bf Mon Sep 17 00:00:00 2001 From: Nicolle Weidner Date: Tue, 7 Jan 2025 10:09:09 -0600 Subject: [PATCH 1/2] FDG-10026 remove high level start check and move to individual field checks --- .../download-report-table-row/download-report-table-row.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.tsx b/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.tsx index 8ceccb1d6..e2dcd6f7e 100644 --- a/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.tsx +++ b/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.tsx @@ -99,7 +99,7 @@ const DownloadReportTableRow: FunctionComponent<{ reportFile: IPublishedReportDa return ( <> - {displayName?.start && displayName?.end && ( + {displayName?.end && (
{`${fileType} - {displayName.start} + {displayName?.start && {displayName.start}} {displayName.end}
{publishedDate}
@@ -132,7 +132,7 @@ const DownloadReportTableRow: FunctionComponent<{ reportFile: IPublishedReportDa {`${fileType}
-
{displayName.start}
+ {displayName?.start &&
{displayName.start}
}
{displayName.end}
From f19e4ac7763a20a3beb8bc3b3d70176887de6230 Mon Sep 17 00:00:00 2001 From: Nicolle Weidner Date: Tue, 7 Jan 2025 11:23:54 -0600 Subject: [PATCH 2/2] FDG-10026 add unit test for short name --- .../download-report-table-row.spec.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.spec.js b/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.spec.js index e656fdfbf..7d69f8a70 100644 --- a/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.spec.js +++ b/src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.spec.js @@ -1,5 +1,5 @@ import React from 'react'; -import { render, act, fireEvent } from '@testing-library/react'; +import { render, act, fireEvent, getByText } from '@testing-library/react'; import DownloadReportTableRow from './download-report-table-row'; import userEvent from '@testing-library/user-event'; @@ -9,6 +9,7 @@ describe('Download report table row component', () => { { path: '/test/file/path/another_file.xml', report_date: 'Fri Jul 19 2024 00:00:00 GMT-0500', report_group_desc: 'Another Download File (.xml)' }, { path: '/test/file/path/another_file.xls', report_date: 'Fri Jul 19 2024 00:00:00 GMT-0500', report_group_desc: 'Another Download File (.xls)' }, { path: '/test/file/path/another_file.txt', report_date: 'Fri Jul 19 2024 00:00:00 GMT-0500', report_group_desc: 'Another Download File (.txt)' }, + { path: '/test/file/path/another_file.txt', report_date: 'Fri Jul 19 2024 00:00:00 GMT-0500', report_group_desc: 'TST (.txt)' }, ]; beforeEach(() => { @@ -20,6 +21,11 @@ describe('Download report table row component', () => { expect(getByTestId('file-download-row')).toBeInTheDocument(); }); + it('renders a short file name in the row', () => { + const { getByText } = render(); + expect(getByText('TST.txt')).toBeInTheDocument(); + }); + it('renders a pdf icon with a pdf filename', () => { const { getByAltText } = render(); expect(getByAltText('.pdf icon')).toBeInTheDocument();