Skip to content

Commit

Permalink
Merge pull request #1571 from fedspendingtransparency/FDG-10026
Browse files Browse the repository at this point in the history
FDG-10026 GAS dataset is not displaying Published reports
  • Loading branch information
chasls2 authored Jan 7, 2025
2 parents 031d8bc + f19e4ac commit f21bcbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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(() => {
Expand All @@ -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(<DownloadReportTableRow reportFile={mockReports[4]} />);
expect(getByText('TST.txt')).toBeInTheDocument();
});

it('renders a pdf icon with a pdf filename', () => {
const { getByAltText } = render(<DownloadReportTableRow reportFile={mockReports[0]} />);
expect(getByAltText('.pdf icon')).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const DownloadReportTableRow: FunctionComponent<{ reportFile: IPublishedReportDa

return (
<>
{displayName?.start && displayName?.end && (
{displayName?.end && (
<tr className={fileDescription} data-testid="file-download-row">
<td>
<a
Expand All @@ -116,7 +116,7 @@ const DownloadReportTableRow: FunctionComponent<{ reportFile: IPublishedReportDa
<div className={downloadFileContainer}>
<div className={downloadName}>
<img src={fileTypeImage} alt={`${fileType} icon`} />
<span className={startName}>{displayName.start}</span>
{displayName?.start && <span className={startName}>{displayName.start}</span>}
<span>{displayName.end}</span>
</div>
<div className={fileDate}>{publishedDate}</div>
Expand All @@ -132,7 +132,7 @@ const DownloadReportTableRow: FunctionComponent<{ reportFile: IPublishedReportDa
<img src={fileTypeImage} alt={`${fileType} icon`} />
<div className={downloadItem}>
<div className={downloadName}>
<div className={startName}>{displayName.start}</div>
{displayName?.start && <div className={startName}>{displayName.start}</div>}
<div className={endName}>{displayName.end}</div>
</div>
<div className={downloadInfo}>
Expand Down

0 comments on commit f21bcbf

Please sign in to comment.