Skip to content

Commit

Permalink
fix assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-ziv committed Feb 15, 2022
1 parent 1290ac6 commit 4653d23
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/utils/object.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

Expand Down
11 changes: 7 additions & 4 deletions src/__tests__/utils/token.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
15 changes: 9 additions & 6 deletions src/__tests__/utils/wallet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@ 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');
});
});

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('');
});
});

0 comments on commit 4653d23

Please sign in to comment.