Skip to content

Commit 188a754

Browse files
committed
fix: case amount is null
1 parent 8ceb9eb commit 188a754

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/components/UI/Ramp/Views/OrderDetails/OrderContent.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ describe('OrderContent', () => {
198198
expect(tokenAmount).toHaveTextContent('... ETH');
199199
});
200200

201+
it('renders "0" when cryptoAmount is zero', () => {
202+
const zeroAmountOrder: RampsOrder = {
203+
...mockOrder,
204+
cryptoAmount: 0,
205+
};
206+
renderOrder(zeroAmountOrder);
207+
const tokenAmount = screen.getByTestId('ramps-order-details-token-amount');
208+
expect(tokenAmount).toHaveTextContent('0 ETH');
209+
});
210+
201211
it('does not render info row when statusDescription is absent', () => {
202212
const orderWithoutDescription: RampsOrder = {
203213
...mockOrder,

app/components/UI/Ramp/Views/OrderDetails/OrderContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ const OrderContent: React.FC<OrderContentProps> = ({
320320
fontWeight={FontWeight.Bold}
321321
twClassName="mt-6 text-center"
322322
>
323-
{order.cryptoAmount
323+
{order.cryptoAmount != null
324324
? (formatSubscriptNotation(
325325
parseFloat(String(order.cryptoAmount)),
326326
) ??

0 commit comments

Comments
 (0)