diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-08-23 11:17:23 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-08-25 09:19:43 +0800 |
commit | 5a1dce15be60fa88d6e317cd6dfa7b993c90c257 (patch) | |
tree | b2f7a4c5cd37775e10f0ba4a4bf815cd0f9e6c4c /packages/contracts/test/utils | |
parent | d2912561585a044eec3cf82b65e76760e7cb47c3 (diff) | |
download | dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.tar dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.tar.gz dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.tar.bz2 dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.tar.lz dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.tar.xz dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.tar.zst dexon-sol-tools-5a1dce15be60fa88d6e317cd6dfa7b993c90c257.zip |
Updated all existing match order tests to use new format
Diffstat (limited to 'packages/contracts/test/utils')
-rw-r--r-- | packages/contracts/test/utils/match_order_tester.ts | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts index c412595f5..00816e7d4 100644 --- a/packages/contracts/test/utils/match_order_tester.ts +++ b/packages/contracts/test/utils/match_order_tester.ts @@ -202,8 +202,6 @@ export class MatchOrderTester { erc20BalancesByOwner: ERC20BalancesByOwner, erc721TokenIdsByOwner: ERC721TokenIdsByOwner, expectedTransferAmounts: TransferAmounts, - leftOrderEndState: OrderStatus, - rightOrderEndState: OrderStatus, initialTakerAssetFilledAmountLeft?: BigNumber, initialTakerAssetFilledAmountRight?: BigNumber, ): Promise<[ERC20BalancesByOwner, ERC721TokenIdsByOwner]> { @@ -234,7 +232,9 @@ export class MatchOrderTester { signedOrderRight, orderTakerAssetFilledAmountLeft, orderTakerAssetFilledAmountRight, - expectedTransferAmounts + expectedTransferAmounts, + initialTakerAssetFilledAmountLeft, + initialTakerAssetFilledAmountRight ); // Verify balances of makers, taker, and fee recipients await this._verifyBalancesAsync( @@ -308,7 +308,9 @@ export class MatchOrderTester { signedOrderRight: SignedOrder, orderTakerAssetFilledAmountLeft: BigNumber, orderTakerAssetFilledAmountRight: BigNumber, - expectedTransferAmounts: TransferAmounts + expectedTransferAmounts: TransferAmounts, + initialTakerAssetFilledAmountLeft?: BigNumber, + initialTakerAssetFilledAmountRight?: BigNumber ) { // Verify state for left order: amount bought by left maker let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync( @@ -323,12 +325,18 @@ export class MatchOrderTester { amountBoughtByRightMaker = amountBoughtByRightMaker.minus(orderTakerAssetFilledAmountRight); expect(expectedTransferAmounts.amountBoughtByRightMaker, "Checking exchange state for right order").to.be.bignumber.equal(amountBoughtByRightMaker); // Verify left order status + const maxAmountBoughtByLeftMaker = initialTakerAssetFilledAmountLeft + ? signedOrderLeft.takerAssetAmount.sub(initialTakerAssetFilledAmountLeft) + : signedOrderLeft.takerAssetAmount; const leftOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderLeft); - const leftExpectedStatus = (expectedTransferAmounts.amountBoughtByLeftMaker.equals(signedOrderLeft.takerAssetAmount)) ? OrderStatus.FULLY_FILLED : OrderStatus.FILLABLE; + const leftExpectedStatus = (expectedTransferAmounts.amountBoughtByLeftMaker.equals(maxAmountBoughtByLeftMaker)) ? OrderStatus.FULLY_FILLED : OrderStatus.FILLABLE; expect(leftOrderInfo.orderStatus as OrderStatus, "Checking exchange status for left order").to.be.equal(leftExpectedStatus); // Verify right order status + const maxAmountBoughtByRightMaker = initialTakerAssetFilledAmountRight + ? signedOrderRight.takerAssetAmount.sub(initialTakerAssetFilledAmountRight) + : signedOrderRight.takerAssetAmount; const rightOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderRight); - const rightExpectedStatus = (expectedTransferAmounts.amountBoughtByRightMaker.equals(signedOrderRight.takerAssetAmount)) ? OrderStatus.FULLY_FILLED : OrderStatus.FILLABLE; + const rightExpectedStatus = (expectedTransferAmounts.amountBoughtByRightMaker.equals(maxAmountBoughtByRightMaker)) ? OrderStatus.FULLY_FILLED : OrderStatus.FILLABLE; expect(rightOrderInfo.orderStatus as OrderStatus, "Checking exchange status for right order").to.be.equal(rightExpectedStatus); } /// @dev Calculates the expected balances of order makers, fee recipients, and the taker, |