From 1e9147b8bb45a251eefdead23573a9e8d68fc34b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 25 Jan 2018 15:12:46 +0100 Subject: Normalize the dependencies --- packages/contracts/test/exchange/core.ts | 59 +++++++++++++------------------ packages/contracts/test/token_registry.ts | 4 +-- 2 files changed, 26 insertions(+), 37 deletions(-) (limited to 'packages/contracts/test') diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 5fe2a9452..ac8c7229e 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -147,9 +147,8 @@ describe('Exchange', () => { takerTokenAmount: new BigNumber(3), }); - const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountBefore).to.be.bignumber.equal(0); const fillTakerTokenAmount1 = new BigNumber(2); @@ -157,9 +156,8 @@ describe('Exchange', () => { fillTakerTokenAmount: fillTakerTokenAmount1, }); - const filledTakerTokenAmountAfter1 = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountAfter1 = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountAfter1).to.be.bignumber.equal(fillTakerTokenAmount1); const fillTakerTokenAmount2 = new BigNumber(1); @@ -167,9 +165,8 @@ describe('Exchange', () => { fillTakerTokenAmount: fillTakerTokenAmount2, }); - const filledTakerTokenAmountAfter2 = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountAfter2 = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountAfter2).to.be.bignumber.equal(filledTakerTokenAmountAfter1); }); @@ -179,17 +176,15 @@ describe('Exchange', () => { takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), }); - const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountBefore).to.be.bignumber.equal(0); const fillTakerTokenAmount = order.params.takerTokenAmount.div(2); await exWrapper.fillOrderAsync(order, taker, { fillTakerTokenAmount }); - const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountAfter).to.be.bignumber.equal(fillTakerTokenAmount); const newBalances = await dmyBalances.getAsync(); @@ -232,17 +227,15 @@ describe('Exchange', () => { takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(100), 18), }); - const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountBefore).to.be.bignumber.equal(0); const fillTakerTokenAmount = order.params.takerTokenAmount.div(2); await exWrapper.fillOrderAsync(order, taker, { fillTakerTokenAmount }); - const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountAfter).to.be.bignumber.equal(fillTakerTokenAmount); const newBalances = await dmyBalances.getAsync(); @@ -285,17 +278,15 @@ describe('Exchange', () => { takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18), }); - const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountBefore).to.be.bignumber.equal(0); const fillTakerTokenAmount = order.params.takerTokenAmount.div(2); await exWrapper.fillOrderAsync(order, taker, { fillTakerTokenAmount }); - const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountAfter).to.be.bignumber.equal(fillTakerTokenAmount); const newBalances = await dmyBalances.getAsync(); @@ -339,17 +330,15 @@ describe('Exchange', () => { takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(200), 18), }); - const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountBefore = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); expect(filledTakerTokenAmountBefore).to.be.bignumber.equal(0); const fillTakerTokenAmount = order.params.takerTokenAmount.div(2); await exWrapper.fillOrderAsync(order, taker, { fillTakerTokenAmount }); - const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync( - order.params.orderHashHex, - ); + const filledTakerTokenAmountAfter = await zeroEx.exchange.getFilledTakerAmountAsync(order.params + .orderHashHex as string); const expectedFillAmountTAfter = fillTakerTokenAmount.add(filledTakerTokenAmountBefore); expect(filledTakerTokenAmountAfter).to.be.bignumber.equal(expectedFillAmountTAfter); @@ -678,7 +667,7 @@ describe('Exchange', () => { expect(newBalances).to.be.deep.equal(balances); }); - it.skip('should throw if getBalance or getAllowance attempts to change state and \ + it('should throw if getBalance or getAllowance attempts to change state and \ shouldThrowOnInsufficientBalanceOrAllowance = false', async () => { const maliciousToken = await deployer.deployAsync('MaliciousToken'); await maliciousToken.approve(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: taker }); @@ -691,7 +680,7 @@ describe('Exchange', () => { exWrapper.fillOrderAsync(order, taker, { shouldThrowOnInsufficientBalanceOrAllowance: false, }), - ).to.be.rejectedWith(constants.REVERT); + ).to.be.rejectedWith(constants.INVALID_OPCODE); }); it('should not change balances if an order is expired', async () => { diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index 1146353da..549b2f175 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -175,7 +175,7 @@ describe('TokenRegistry', () => { }); it('should change the token symbol when called by owner', async () => { - const res = await tokenReg.setTokenSymbol(token1.address, token2.symbol, { from: owner }); + await tokenReg.setTokenSymbol(token1.address, token2.symbol, { from: owner }); const [newData, oldData] = await Promise.all([ tokenRegWrapper.getTokenBySymbolAsync(token2.symbol), tokenRegWrapper.getTokenBySymbolAsync(token1.symbol), @@ -216,7 +216,7 @@ describe('TokenRegistry', () => { it('should remove token metadata when called by owner', async () => { const index = 0; - const res = await tokenReg.removeToken(token1.address, index, { + await tokenReg.removeToken(token1.address, index, { from: owner, }); const tokenData = await tokenRegWrapper.getTokenMetaDataAsync(token1.address); -- cgit v1.2.3