diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-05-16 07:11:20 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-05-19 08:01:06 +0800 |
commit | 93087324d9b57c87d48d0b7b3cbb28437927ffeb (patch) | |
tree | 439814824780234caf29b700545508493dd96bc9 /packages/contracts/test/exchange | |
parent | 061facdcceddbc68620ae710c1f2fb2c99e4d3f3 (diff) | |
download | dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.tar dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.tar.gz dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.tar.bz2 dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.tar.lz dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.tar.xz dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.tar.zst dexon-sol-tools-93087324d9b57c87d48d0b7b3cbb28437927ffeb.zip |
Throw if the left or right orders do not compute the correct fill results. I like this better than just logging an error and failing silently.
Diffstat (limited to 'packages/contracts/test/exchange')
-rw-r--r-- | packages/contracts/test/exchange/match_orders.ts | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 6ba88b5fb..74e4f6760 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -647,7 +647,7 @@ describe('matchOrders', () => { ); }); - it('Should not transfer any amounts if left order is not fillable', async () => { + it('Should throw if left order is not fillable', async () => { // Create orders to match const signedOrderLeft = orderFactoryLeft.newSignedOrder({ makerAddress: makerAddressLeft, @@ -668,13 +668,12 @@ describe('matchOrders', () => { // Cancel left order await exchangeWrapper.cancelOrderAsync(signedOrderLeft, signedOrderLeft.makerAddress); // Match orders - await exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress); - // Verify balances did not change - const newBalances = await erc20Wrapper.getBalancesAsync(); - expect(newBalances).to.be.deep.equal(erc20BalancesByOwner); + return expect( + exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), + ).to.be.rejectedWith(constants.REVERT); }); - it('Should not transfer any amounts if right order is not fillable', async () => { + it('Should throw if right order is not fillable', async () => { // Create orders to match const signedOrderLeft = orderFactoryLeft.newSignedOrder({ makerAddress: makerAddressLeft, @@ -695,10 +694,9 @@ describe('matchOrders', () => { // Cancel right order await exchangeWrapper.cancelOrderAsync(signedOrderRight, signedOrderRight.makerAddress); // Match orders - await exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress); - // Verify balances did not change - const newBalances = await erc20Wrapper.getBalancesAsync(); - expect(newBalances).to.be.deep.equal(erc20BalancesByOwner); + return expect( + exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress), + ).to.be.rejectedWith(constants.REVERT); }); it('should throw if there is not a positive spread', async () => { |