diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 03:08:21 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 07:34:45 +0800 |
commit | 3e596f6a8c211eb39917cfd2a9a68a6facf2c904 (patch) | |
tree | b40e41c992ce2c9f5ad2e9893c12e7fa810c96ce | |
parent | c3884dfa32d0d8292163892934d7f243e813590f (diff) | |
download | dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.gz dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.bz2 dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.lz dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.xz dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.zst dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.zip |
Nesting errors
-rw-r--r-- | packages/instant/test/util/asset.test.ts | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/packages/instant/test/util/asset.test.ts b/packages/instant/test/util/asset.test.ts index c13424685..dbf2e15a5 100644 --- a/packages/instant/test/util/asset.test.ts +++ b/packages/instant/test/util/asset.test.ts @@ -64,29 +64,31 @@ describe('assetDataUtil', () => { 'Not enough ZRX available', ); }); - it('should return custom message for InsufficientAssetLiquidityError error for token w/ 18 decimals', () => { - const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(20.059), 18); - expect( - assetUtils.assetBuyerErrorMessage(ZRX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), - ).toEqual('There are only 20.05 ZRX available to buy'); - }); - it('should return custom message for InsufficientAssetLiquidityError error for token w/ 18 decimals and small amount available', () => { - const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(0.01), 18); - expect( - assetUtils.assetBuyerErrorMessage(ZRX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), - ).toEqual('There are only 0.01 ZRX available to buy'); - }); - it('should return custom message for InsufficientAssetLiquidityError error for token w/ 8 decimals', () => { - const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 8); - expect( - assetUtils.assetBuyerErrorMessage(WAX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), - ).toEqual('There are only 3 WAX available to buy'); - }); - it('should generic message for InsufficientAssetLiquidityError error when amount available rounds to zero', () => { - const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(0.002), 18); - expect( - assetUtils.assetBuyerErrorMessage(ZRX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), - ).toEqual('Not enough ZRX available'); + describe('InsufficientAssetLiquidityError', () => { + it('should return custom message for token w/ 18 decimals', () => { + const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(20.059), 18); + expect( + assetUtils.assetBuyerErrorMessage(ZRX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), + ).toEqual('There are only 20.05 ZRX available to buy'); + }); + it('should return custom message for token w/ 18 decimals and small amount available', () => { + const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(0.01), 18); + expect( + assetUtils.assetBuyerErrorMessage(ZRX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), + ).toEqual('There are only 0.01 ZRX available to buy'); + }); + it('should return custom message for token w/ 8 decimals', () => { + const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 8); + expect( + assetUtils.assetBuyerErrorMessage(WAX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), + ).toEqual('There are only 3 WAX available to buy'); + }); + it('should generic message when amount available rounds to zero', () => { + const amountAvailable = Web3Wrapper.toBaseUnitAmount(new BigNumber(0.002), 18); + expect( + assetUtils.assetBuyerErrorMessage(ZRX_ASSET, new InsufficientAssetLiquidityError(amountAvailable)), + ).toEqual('Not enough ZRX available'); + }); }); it('should return message for InsufficientZrxLiquidity', () => { const insufficientZrxError = new Error(AssetBuyerError.InsufficientZrxLiquidity); |