From 4653d23f040269d9f49e90b20af741c473760367 Mon Sep 17 00:00:00 2001 From: Dan Ziv Date: Tue, 15 Feb 2022 12:04:19 +0200 Subject: [PATCH] fix assertion --- src/__tests__/utils/object.spec.js | 2 +- src/__tests__/utils/token.spec.js | 11 +++++++---- src/__tests__/utils/wallet.spec.js | 15 +++++++++------ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/__tests__/utils/object.spec.js b/src/__tests__/utils/object.spec.js index 8f9155f6..49f865e9 100644 --- a/src/__tests__/utils/object.spec.js +++ b/src/__tests__/utils/object.spec.js @@ -14,7 +14,7 @@ describe('getPropertyPath', () => { expect(getPropertyPath(obj, 'c')).toEqual({ d: true }); - expect(getPropertyPath(obj, 'c.d')).toEqual(true); + expect(getPropertyPath(obj, 'c.d')).toBeTruthy(); }); }); diff --git a/src/__tests__/utils/token.spec.js b/src/__tests__/utils/token.spec.js index f6402818..f7470b0b 100644 --- a/src/__tests__/utils/token.spec.js +++ b/src/__tests__/utils/token.spec.js @@ -2,15 +2,18 @@ import {isEth} from '../../utils'; describe('isEth', () => { it('should return true for eth symbol as string', () => { - expect(isEth('ETH')).toEqual(true); + expect(isEth('ETH')).toBeTruthy(); }); + it('should return true for eth token as object', () => { - expect(isEth({symbol: 'ETH'})).toEqual(true); + expect(isEth({symbol: 'ETH'})).toBeTruthy(); }); + it('should return false for non-eth symbol as string', () => { - expect(isEth('DAI')).toEqual(false); + expect(isEth('DAI')).toBeFalsy(); }); + it('should return false for non-eth token as object', () => { - expect(isEth({symbol: 'DAI'})).toEqual(false); + expect(isEth({symbol: 'DAI'})).toBeFalsy(); }); }); diff --git a/src/__tests__/utils/wallet.spec.js b/src/__tests__/utils/wallet.spec.js index 017676e7..148116f8 100644 --- a/src/__tests__/utils/wallet.spec.js +++ b/src/__tests__/utils/wallet.spec.js @@ -6,10 +6,11 @@ describe('formatBalance', () => { expect(formatBalance(3000.232143123212)).toEqual(3000.23214); expect(formatBalance(10.000000001)).toEqual(10); }); + it('should return N/A for non-numbers', () => { - expect(formatBalance('')).toEqual('N/A'); - expect(formatBalance(null)).toEqual('N/A'); - expect(formatBalance()).toEqual('N/A'); + expect(formatBalance('')).toBe('N/A'); + expect(formatBalance(null)).toBe('N/A'); + expect(formatBalance()).toBe('N/A'); }); }); @@ -17,12 +18,14 @@ describe('shortenAddress', () => { it('should shorten long address', () => { expect(shortenAddress('0x9e2bd0a6b6b98f4586a867678f5ebd3dcfda02e7')).toEqual('0x9e2...2e7'); }); + it('should return the same address for short address', () => { expect(shortenAddress('0x9ed0a')).toEqual('0x9ed0a'); }); + it('should return empty string for bad input', () => { - expect(shortenAddress('')).toEqual(''); - expect(shortenAddress()).toEqual(''); - expect(shortenAddress(null)).toEqual(''); + expect(shortenAddress('')).toBe(''); + expect(shortenAddress()).toBe(''); + expect(shortenAddress(null)).toBe(''); }); });