From 132442e97e65f7d82710dc406ddecd78eacc7a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Santana=20Gon=C3=A7alves?= Date: Thu, 22 Feb 2024 00:35:04 -0300 Subject: [PATCH] remove zero as special case --- src/shared/utils/index.test.ts | 6 +++--- src/shared/utils/index.ts | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/shared/utils/index.test.ts b/src/shared/utils/index.test.ts index 6ce4d28f9..726d56a20 100644 --- a/src/shared/utils/index.test.ts +++ b/src/shared/utils/index.test.ts @@ -48,9 +48,9 @@ describe('formatTokenValue', () => { }) test('handles zero as a special case', () => { - expect(formatTokenValue(0)).toBe('0.00') - expect(formatTokenValue('0')).toBe('0.00') - expect(formatTokenValue('0.000000')).toBe('0.00') + expect(formatTokenValue(0)).toBe('0') + expect(formatTokenValue('0')).toBe('0') + expect(formatTokenValue('0.000000')).toBe('0') }) test('formats very small token values correctly', () => { diff --git a/src/shared/utils/index.ts b/src/shared/utils/index.ts index c7b7c072b..bb21d154c 100644 --- a/src/shared/utils/index.ts +++ b/src/shared/utils/index.ts @@ -70,11 +70,6 @@ const formatNumber = ( sign = '', } = options - // Immediately return "0.00" for zero values - if (num === 0) { - return `${sign}0.00` - } - // Calculate the minimum value that can be displayed given the number of decimal places const minValue = 1 / Math.pow(10, decimalPlaces)