Skip to content

Commit

Permalink
FDG-10026 add unit test for short name
Browse files Browse the repository at this point in the history
  • Loading branch information
nicweidner committed Jan 7, 2025
1 parent 26c5da0 commit f19e4ac
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit f19e4ac

Please sign in to comment.