diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 06:26:40 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-07 06:26:40 +0800 |
commit | a97d77064aacda3de74b04894f110b05298c5ca8 (patch) | |
tree | fa8cfc4b0bf65b065fd2c7acc2691b1b2c6261bd /packages/order-watcher | |
parent | 6a2da6dc06c616ba50930bbe04a6fa200885ecfd (diff) | |
download | dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.tar dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.tar.gz dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.tar.bz2 dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.tar.lz dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.tar.xz dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.tar.zst dexon-sol-tools-a97d77064aacda3de74b04894f110b05298c5ca8.zip |
Get build and tests to pass
Diffstat (limited to 'packages/order-watcher')
-rw-r--r-- | packages/order-watcher/src/utils/assert.ts | 5 | ||||
-rw-r--r-- | packages/order-watcher/test/order_watcher_test.ts | 29 |
2 files changed, 18 insertions, 16 deletions
diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts index e88f9ac72..5d7f72716 100644 --- a/packages/order-watcher/src/utils/assert.ts +++ b/packages/order-watcher/src/utils/assert.ts @@ -1,9 +1,10 @@ import { assert as sharedAssert } from '@0xproject/assert'; // We need those two unused imports because they're actually used by sharedAssert which gets injected here -// tslint:disable-next-line:no-unused-variable +// tslint:disable:no-unused-variable import { Schema } from '@0xproject/json-schemas'; -// tslint:disable-next-line:no-unused-variable import { ECSignature } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +// tslint:enable:no-unused-variable import { isValidSignature } from '@0xproject/order-utils'; diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index d8c918f16..c2161ada6 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -1,8 +1,9 @@ +// tslint:disable:no-unnecessary-type-assertion import { ContractWrappers } from '@0xproject/contract-wrappers'; import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; import { FillScenarios } from '@0xproject/fill-scenarios'; import { getOrderHashHex } from '@0xproject/order-utils'; -import { DoneCallback, ExchangeContractErrs, OrderState, SignedOrder, Token } from '@0xproject/types'; +import { DoneCallback, ExchangeContractErrs, OrderState, OrderStateInvalid, SignedOrder, Token, OrderStateValid } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; @@ -132,7 +133,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState; + const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance); }); @@ -181,7 +182,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState; + const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance); }); @@ -205,7 +206,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState; + const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero); }); @@ -237,7 +238,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; const remainingMakerBalance = makerBalance.sub(fillAmountInBaseUnits); @@ -298,7 +299,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( @@ -332,7 +333,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( changedMakerApprovalAmount, @@ -367,7 +368,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingAmount, @@ -407,7 +408,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingTokenAmount, @@ -440,7 +441,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( remainingFeeAmount, @@ -475,7 +476,7 @@ describe('OrderWatcher', () => { orderWatcher.addOrder(signedOrder); const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.remainingFillableMakerTokenAmount).to.be.bignumber.equal( fillableAmount, @@ -504,7 +505,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState; + const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero); }); @@ -528,7 +529,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState; + const invalidOrderState = orderState as OrderStateInvalid; expect(invalidOrderState.orderHash).to.be.equal(orderHash); expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderFillRoundingError); }); @@ -555,7 +556,7 @@ describe('OrderWatcher', () => { const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => { expect(orderState.isValid).to.be.true(); - const validOrderState = orderState; + const validOrderState = orderState as OrderStateValid; expect(validOrderState.orderHash).to.be.equal(orderHash); const orderRelevantState = validOrderState.orderRelevantState; expect(orderRelevantState.cancelledTakerTokenAmount).to.be.bignumber.equal(cancelAmountInBaseUnits); |