diff --git a/app/components/UI/Rewards/components/Campaigns/OndoActivityRow.test.tsx b/app/components/UI/Rewards/components/Campaigns/OndoActivityRow.test.tsx index 18be482b848..38d0b2dd162 100644 --- a/app/components/UI/Rewards/components/Campaigns/OndoActivityRow.test.tsx +++ b/app/components/UI/Rewards/components/Campaigns/OndoActivityRow.test.tsx @@ -104,6 +104,18 @@ describe('OndoActivityRow', () => { expect(getByText('—')).toBeDefined(); }); + it('renders rebalance entry USD without a plus sign for positive amounts', () => { + const { getByText } = render( + , + ); + + expect(getByText('Rebalance')).toBeDefined(); + // formatUsd (rebalance) has no '+'; deposit/withdraw still use mocked formatSignedUsd + expect(getByText(/^\$5,000/)).toBeDefined(); + }); + it('renders external outflow entry with shortened destAddress', () => { const { getByText } = render( = { const tokenLabel = (token: ActivityTokenDto): string => token.tokenSymbol || token.tokenName; +/** Rebalance USD is not portfolio P&L; omit the '+' used for signed inflows/outflows. */ +const formatActivityUsd = ( + usdAmount: OndoGmActivityEntryDto['usdAmount'], + entryType: ActivityEntryType, +): string => { + if (entryType !== 'REBALANCE') { + return formatSignedUsd(usdAmount); + } + if (usdAmount === null) { + return '—'; + } + const num = typeof usdAmount === 'number' ? usdAmount : parseFloat(usdAmount); + if (Number.isNaN(num)) { + return '—'; + } + return formatUsd(usdAmount); +}; + interface OndoActivityRowProps { entry: OndoGmActivityEntryDto; timeOnly?: boolean; @@ -123,7 +142,7 @@ const OndoActivityRow: React.FC = ({ {label} - {formatSignedUsd(entry.usdAmount)} + {formatActivityUsd(entry.usdAmount, entryType)}