From 93087324d9b57c87d48d0b7b3cbb28437927ffeb Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Tue, 15 May 2018 16:11:20 -0700 Subject: 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. --- packages/contracts/test/exchange/match_orders.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'packages/contracts/test/exchange/match_orders.ts') 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 () => { -- cgit v1.2.3