aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/test/util
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-23 05:01:08 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-23 05:01:08 +0800
commit37c5165319d5962aedc683c105df446ce62cd72f (patch)
tree3cd9ce3694e8e9036ad3f896d1416b9f4dd68f53 /packages/instant/test/util
parent15ed3b35df1103ac9b0b4104551ecff9559ddb9b (diff)
downloaddexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.gz
dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.tar.zst
dexon-sol-tools-37c5165319d5962aedc683c105df446ce62cd72f.zip
feat: add asset tests
Diffstat (limited to 'packages/instant/test/util')
-rw-r--r--packages/instant/test/util/asset.test.ts25
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');
+ });
+ });
+});