From 3978b099674f71748e11622a3d7aef92bc509a5a Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 12 Sep 2023 11:42:44 +0700 Subject: [PATCH] add edgecase --- src/utils/tests/numbers.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/tests/numbers.test.ts b/src/utils/tests/numbers.test.ts index 38b9504db6..31545604ee 100644 --- a/src/utils/tests/numbers.test.ts +++ b/src/utils/tests/numbers.test.ts @@ -115,6 +115,9 @@ describe('formatDisplayNumber tests', () => { test('format number 123456789123456789 correctly', () => { expect(formatDisplayNumber(123456789123456789, { significantDigits: 18 })).toBe('123,456,789,123,456,780') }) + test('format number 1234567891234567891 correctly', () => { + expect(formatDisplayNumber(1234567891234567891, { significantDigits: 18 })).toBe('1,234,567.891234568T') + }) }) }) describe('small numbers', () => { @@ -508,7 +511,10 @@ describe('formatDisplayNumber tests', () => { expect(formatDisplayNumber('123456789', { significantDigits: 18 })).toBe('123,456,789') }) test('format string 123456789123456789 correctly', () => { - expect(formatDisplayNumber('123456789123456789', { significantDigits: 6 })).toBe('123,457T') + expect(formatDisplayNumber('123456789123456789', { significantDigits: 18 })).toBe('123,456,789,123,456,780') + }) + test('format string 1234567891234567891 correctly', () => { + expect(formatDisplayNumber('1234567891234567891', { significantDigits: 18 })).toBe('1,234,567.891234568T') }) }) })