Skip to content

Commit

Permalink
remove zero as special case
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoncalves committed Feb 22, 2024
1 parent 04e51b7 commit 132442e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/shared/utils/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
5 changes: 0 additions & 5 deletions src/shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 132442e

Please sign in to comment.