From ca786cdd1143f6e116b91769e6620bff31642fd5 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 5 Mar 2018 11:55:08 -0800 Subject: Fix log decoding --- packages/contracts/test/exchange/core.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index ae136816e..63a62396a 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -394,7 +394,7 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, taker, { takerTokenFillAmount: signedOrder.takerTokenAmount, }); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal( signedOrder.takerTokenAmount.minus(takerTokenFillAmount), ); @@ -430,7 +430,7 @@ describe('Exchange', () => { }); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; const logArgs = log.args; const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor); const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor); @@ -461,7 +461,7 @@ describe('Exchange', () => { }); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; const logArgs = log.args; const expectedFilledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor); const expectedFilledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor); @@ -689,8 +689,8 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, taker); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; - const errCode = log.args.errorId.toNumber(); + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; + const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED); }); @@ -700,8 +700,8 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, taker); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; - const errCode = log.args.errorId.toNumber(); + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; + const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED); }); }); @@ -761,7 +761,7 @@ describe('Exchange', () => { const res = await exWrapper.fillOrderAsync(signedOrder, taker, { takerTokenFillAmount: signedOrder.takerTokenAmount, }); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; expect(log.args.takerTokenFilledAmount).to.be.bignumber.equal( signedOrder.takerTokenAmount.minus(takerTokenCancelAmount), ); @@ -806,7 +806,7 @@ describe('Exchange', () => { }); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; const logArgs = log.args; const expectedCancelledMakerTokenAmount = signedOrder.makerTokenAmount.div(divisor); const expectedCancelledTakerTokenAmount = signedOrder.takerTokenAmount.div(divisor); @@ -827,8 +827,8 @@ describe('Exchange', () => { const res = await exWrapper.cancelOrderAsync(signedOrder, maker); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; - const errCode = log.args.errorId.toNumber(); + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; + const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED); }); @@ -839,8 +839,8 @@ describe('Exchange', () => { const res = await exWrapper.cancelOrderAsync(signedOrder, maker); expect(res.logs).to.have.length(1); - const log = logDecoder.tryToDecodeLogOrNoop(res.logs[0]) as LogWithDecodedArgs; - const errCode = log.args.errorId.toNumber(); + const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs; + const errCode = log.args.errorId; expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_EXPIRED); }); }); -- cgit