Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2170,6 +2170,7 @@
"Only delete if you know that this user will not be returning to any other missional organization that uses {{appName}}. You may need to confirm this with them.": "Only delete if you know that this user will not be returning to any other missional organization that uses {{appName}}. You may need to confirm this with them.",
"Only import contacts from certain groups": "Only import contacts from certain groups",
"Only include medical expenses that are not reimbursable through your staff account.": "Only include medical expenses that are not reimbursable through your staff account.",
"Only the last year of transfer history is shown.": "Only the last year of transfer history is shown.",
"Only the portion not reimbursed as ministry expense.": "Only the portion not reimbursed as ministry expense.",
"Open hours per week calculator": "Open hours per week calculator",
"Opening Balance": "Opening Balance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,20 @@ const mockTransfer: Transfers = {
missingMonths: [DateTime.fromISO('2023-08-15')],
};

const TestComponent: React.FC = () => {
const TestComponent: React.FC<{ transfer?: Transfers }> = ({
transfer = mockTransfer,
}) => {
return (
<ThemeProvider theme={theme}>
<LocalizationProvider dateAdapter={AdapterLuxon}>
<FailedTransferModal
handleClose={handleClose}
transfer={mockTransfer}
/>
<FailedTransferModal handleClose={handleClose} transfer={transfer} />
</LocalizationProvider>
</ThemeProvider>
);
};

const historyNote = 'Only the last year of transfer history is shown.';

describe('FailedTransferModal', () => {
it('renders the modal', () => {
const { getByText, getAllByRole, getByRole } = render(<TestComponent />);
Expand All @@ -137,6 +138,20 @@ describe('FailedTransferModal', () => {
expect(button[1]).toBeInTheDocument();
});

it('explains that only the last year of history is shown when the transfer started before the window', () => {
const { getByText } = render(
<TestComponent transfer={{ ...mockTransfer, historyTruncated: true }} />,
);

expect(getByText(historyNote)).toBeInTheDocument();
});

it('omits the history note when the whole transfer fits inside the window', () => {
const { queryByText } = render(<TestComponent />);

expect(queryByText(historyNote)).not.toBeInTheDocument();
});

it('renders the correct number of transfer rows', () => {
const { getByRole } = render(<TestComponent />);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ export const FailedTransferModal: React.FC<FailedTransferModalProps> = ({
</TableBody>
</Table>
</TableContainer>
{transfer.historyTruncated && (
<Typography variant="body2" sx={{ mt: 2 }}>
{t('Only the last year of transfer history is shown.')}
</Typography>
)}
<Typography variant="body2" sx={{ mt: 2 }}>
<Trans t={t}>
For more information about failed transfers, email{' '}
Expand Down
Loading
Loading