From 37c5165319d5962aedc683c105df446ce62cd72f Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 22 Oct 2018 14:01:08 -0700 Subject: feat: add asset tests --- packages/instant/test/util/asset.test.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 packages/instant/test/util/asset.test.ts (limited to 'packages/instant/test') 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'); + }); + }); +}); -- cgit v1.2.3