aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/test/util
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-15 03:08:21 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-12-15 07:34:45 +0800
commit3e596f6a8c211eb39917cfd2a9a68a6facf2c904 (patch)
treeb40e41c992ce2c9f5ad2e9893c12e7fa810c96ce /packages/instant/test/util
parentc3884dfa32d0d8292163892934d7f243e813590f (diff)
downloaddexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.gz
dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.tar.zst
dexon-sol-tools-3e596f6a8c211eb39917cfd2a9a68a6facf2c904.zip
Nesting errors
Diffstat (limited to 'packages/instant/test/util')
-rw-r--r--packages/instant/test/util/asset.test.ts48
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);