Skip to content

Commit

Permalink
Merge pull request #1073 from CruGlobal/MPDX-8225
Browse files Browse the repository at this point in the history
MPDX-8225 - Prevent ContactPartnershipStatus.tsx from rendering "0" when pledge amount is 0
  • Loading branch information
dr-bizz authored Sep 16, 2024
2 parents 943b853 + 4982ad0 commit 98a1919
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,45 @@ describe('ContactPartnershipStatus', () => {
),
).toBeInTheDocument();
});

describe('pledge amount', () => {
it('renders pledge amount', () => {
const { getByText } = render(
<ThemeProvider theme={theme}>
<I18nextProvider i18n={i18n}>
<ContactPartnershipStatus
lateAt={null}
contactDetailsOpen={false}
pledgeAmount={100}
pledgeCurrency={'USD'}
pledgeFrequency={null}
pledgeReceived={false}
status={ContactPartnershipStatusEnum.PartnerPray}
/>
</I18nextProvider>
</ThemeProvider>,
);
expect(getByText('$100')).toBeInTheDocument();
});

it('does not render pledge amount when 0', () => {
const { queryByText } = render(
<ThemeProvider theme={theme}>
<I18nextProvider i18n={i18n}>
<ContactPartnershipStatus
lateAt={null}
contactDetailsOpen={false}
pledgeAmount={0}
pledgeCurrency={'USD'}
pledgeFrequency={null}
pledgeReceived={false}
status={ContactPartnershipStatusEnum.PartnerPray}
/>
</I18nextProvider>
</ThemeProvider>,
);
expect(queryByText('$0')).not.toBeInTheDocument();
expect(queryByText('0')).not.toBeInTheDocument();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const ContactPartnershipStatus: React.FC<
<Typography component="span">
{pledgeAmount && pledgeCurrency
? currencyFormat(pledgeAmount, pledgeCurrency, locale)
: pledgeAmount}{' '}
: pledgeAmount || ''}{' '}
{pledgeFrequency && getLocalizedPledgeFrequency(t, pledgeFrequency)}{' '}
{status === ContactPartnershipStatusEnum.PartnerFinancial &&
lateStatusEnum !== undefined && (
Expand Down

0 comments on commit 98a1919

Please sign in to comment.