diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 07:18:20 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-15 07:34:45 +0800 |
commit | 69054d85e80f9e41200015a9b0eef2a9fe00f439 (patch) | |
tree | c8296279c2f51518940cc772a26e626f5931e9de /packages/asset-buyer/test/utils | |
parent | 3e596f6a8c211eb39917cfd2a9a68a6facf2c904 (diff) | |
download | dexon-0x-contracts-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.gz dexon-0x-contracts-69054d85e80f9e41200015a9b0eef2a9fe00f439.tar.zst dexon-0x-contracts-69054d85e80f9e41200015a9b0eef2a9fe00f439.zip |
Only send in amountAvailableToFill if it's a non-zero amount, add additional tests and nest, and put error into its own file
Diffstat (limited to 'packages/asset-buyer/test/utils')
-rw-r--r-- | packages/asset-buyer/test/utils/test_helpers.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/asset-buyer/test/utils/test_helpers.ts b/packages/asset-buyer/test/utils/test_helpers.ts index b99906792..d746316f8 100644 --- a/packages/asset-buyer/test/utils/test_helpers.ts +++ b/packages/asset-buyer/test/utils/test_helpers.ts @@ -1,12 +1,12 @@ import { BigNumber } from '@0x/utils'; -import { InsufficientAssetLiquidityError } from '../../src/types'; +import { InsufficientAssetLiquidityError } from '../../src/errors'; export const testHelpers = { expectInsufficientLiquidityError: ( expect: Chai.ExpectStatic, functionWhichTriggersError: () => void, - expectedAmountAvailableToFill: BigNumber, + expectedAmountAvailableToFill?: BigNumber, ): void => { let errorThrown = false; try { @@ -14,7 +14,11 @@ export const testHelpers = { } catch (e) { errorThrown = true; expect(e).to.be.instanceOf(InsufficientAssetLiquidityError); - expect(e.amountAvailableToFill).to.be.bignumber.equal(expectedAmountAvailableToFill); + if (expectedAmountAvailableToFill) { + expect(e.amountAvailableToFill).to.be.bignumber.equal(expectedAmountAvailableToFill); + } else { + expect(e.amountAvailableToFill).to.be.undefined(); + } } expect(errorThrown).to.be.true(); |