Skip to content

Commit

Permalink
display 6 decimal digits (#1703)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber authored Jul 16, 2024
1 parent d7372ba commit c24e4a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions renderer/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export function truncateString (value: string, size = 6) {

export function formatFilValue (value = '') {
const str = new FilecoinNumber(String(value), 'fil')
.decimalPlaces(3, BigNumber.ROUND_DOWN)
.decimalPlaces(6, BigNumber.ROUND_DOWN)
.toString()
const [whole, decimal = ''] = str.split('.')
return `${whole}.${decimal.padEnd(3, '0')}`
return `${whole}.${decimal.padEnd(6, '0')}`
}

export function openExplorerLink (hash?: string) {
Expand Down
6 changes: 3 additions & 3 deletions renderer/src/test/dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Dashboard page', () => {
})

test('displays earnings counter null', () => {
expect(screen.getByTestId('earnings-counter').textContent).toBe('1.000 FIL')
expect(screen.getByTestId('earnings-counter').textContent).toBe('1.000000 FIL')
})

test('displays empty activity log', () => {
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('Dashboard page', () => {
})

test('subscribes and listens the earnings counter', async () => {
expect(screen.getByTestId('earnings-counter').textContent).toBe('0.000 FIL')
expect(screen.getByTestId('earnings-counter').textContent).toBe('0.000000 FIL')

act(() => {
vi.runAllTimers()
Expand All @@ -193,7 +193,7 @@ describe('Dashboard page', () => {
vi.useRealTimers()

await waitFor(() => {
expect(screen.getByTestId('earnings-counter').textContent).toBe('10.000 FIL')
expect(screen.getByTestId('earnings-counter').textContent).toBe('10.000000 FIL')
})
})
})
Expand Down

0 comments on commit c24e4a9

Please sign in to comment.