diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-23 05:01:08 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-23 05:01:08 +0800 |
commit | 37c5165319d5962aedc683c105df446ce62cd72f (patch) | |
tree | 3cd9ce3694e8e9036ad3f896d1416b9f4dd68f53 /packages | |
parent | 15ed3b35df1103ac9b0b4104551ecff9559ddb9b (diff) | |
download | dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.gz dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.bz2 dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.lz dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.xz dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.zst dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.zip |
feat: add asset tests
Diffstat (limited to 'packages')
-rw-r--r-- | packages/instant/test/util/asset.test.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/packages/instant/test/util/asset.test.ts b/packages/instant/test/util/asset.test.ts new file mode 100644 index 000000000..9ca4a3d52 --- /dev/null +++ b/packages/instant/test/util/asset.test.ts @@ -0,0 +1,25 @@ +import { AssetProxyId } from '@0x/types'; + +import { Asset } from '../../src/types'; +import { assetUtils } from '../../src/util/asset'; + +const ZRX_ASSET_DATA = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498'; +const ZRX_ASSET: Asset = { + assetData: ZRX_ASSET_DATA, + metaData: { + assetProxyId: AssetProxyId.ERC20, + symbol: 'zrx', + decimals: 18, + }, +}; + +describe('assetDataUtil', () => { + describe('bestNameForAsset', () => { + it('should return default string if assetData is undefined', () => { + expect(assetUtils.bestNameForAsset(undefined, 'xyz')).toEqual('xyz'); + }); + it('should return ZRX for ZRX assetData', () => { + expect(assetUtils.bestNameForAsset(ZRX_ASSET, 'mah default')).toEqual('ZRX'); + }); + }); +}); |