aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/test
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-13 09:34:14 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-13 09:35:04 +0800
commit8d54772389b28dec021aa81423ac84795e132581 (patch)
treec8f4838b25bd041b7e4d9ead65b6c5da03e69210 /packages/instant/test
parent167a3fbc112120b6a583f3ec3c8fdd70d39df078 (diff)
downloaddexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.tar
dexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.tar.gz
dexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.tar.bz2
dexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.tar.lz
dexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.tar.xz
dexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.tar.zst
dexon-sol-tools-8d54772389b28dec021aa81423ac84795e132581.zip
show < 0.00001 ETH when amount gets really small
Diffstat (limited to 'packages/instant/test')
-rw-r--r--packages/instant/test/util/format.test.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/instant/test/util/format.test.ts b/packages/instant/test/util/format.test.ts
index b74d6cdaa..38bf356ec 100644
--- a/packages/instant/test/util/format.test.ts
+++ b/packages/instant/test/util/format.test.ts
@@ -42,8 +42,16 @@ describe('format', () => {
expect(format.ethUnitAmount(BIG_NUMBER_IRRATIONAL)).toBe('5.301 ETH');
});
it('shows 1 significant digit when rounded amount would be 0', () => {
- expect(format.ethUnitAmount(new BigNumber(0.00000045))).toBe('0.0000005 ETH');
- expect(format.ethUnitAmount(new BigNumber(0.00000044))).toBe('0.0000004 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.00003))).toBe('0.00003 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000034))).toBe('0.00003 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000035))).toBe('0.00004 ETH');
+ });
+ it('shows < 0.00001 when hits threshold', () => {
+ expect(format.ethUnitAmount(new BigNumber(0.000011))).toBe('0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.00001))).toBe('0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000009))).toBe('< 0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.0000000009))).toBe('< 0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0))).toBe('0 ETH');
});
it('returns defaultText param when ethUnitAmount is not defined', () => {
const defaultText = 'defaultText';