Skip to content

Commit f19e4ac

Browse files
committed
FDG-10026 add unit test for short name
1 parent 26c5da0 commit f19e4ac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/published-reports/download-report-table/download-report-table-row/download-report-table-row.spec.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { render, act, fireEvent } from '@testing-library/react';
2+
import { render, act, fireEvent, getByText } from '@testing-library/react';
33
import DownloadReportTableRow from './download-report-table-row';
44
import userEvent from '@testing-library/user-event';
55

@@ -9,6 +9,7 @@ describe('Download report table row component', () => {
99
{ 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)' },
1010
{ 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)' },
1111
{ 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)' },
12+
{ path: '/test/file/path/another_file.txt', report_date: 'Fri Jul 19 2024 00:00:00 GMT-0500', report_group_desc: 'TST (.txt)' },
1213
];
1314

1415
beforeEach(() => {
@@ -20,6 +21,11 @@ describe('Download report table row component', () => {
2021
expect(getByTestId('file-download-row')).toBeInTheDocument();
2122
});
2223

24+
it('renders a short file name in the row', () => {
25+
const { getByText } = render(<DownloadReportTableRow reportFile={mockReports[4]} />);
26+
expect(getByText('TST.txt')).toBeInTheDocument();
27+
});
28+
2329
it('renders a pdf icon with a pdf filename', () => {
2430
const { getByAltText } = render(<DownloadReportTableRow reportFile={mockReports[0]} />);
2531
expect(getByAltText('.pdf icon')).toBeInTheDocument();

0 commit comments

Comments
 (0)