diff options
Diffstat (limited to 'test/order_state_watcher_test.ts')
-rw-r--r-- | test/order_state_watcher_test.ts | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/test/order_state_watcher_test.ts b/test/order_state_watcher_test.ts index 2b1aa68b7..c8a4a8064 100644 --- a/test/order_state_watcher_test.ts +++ b/test/order_state_watcher_test.ts @@ -352,67 +352,5 @@ describe('OrderStateWatcher', () => { await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelAmountInBaseUnits); })().catch(done); }); - describe('check numConfirmations behavior', () => { - before(() => { - const configs: ZeroExConfig = { - orderWatcherConfig: { - numConfirmations: 1, - }, - }; - zeroEx = new ZeroEx(web3.currentProvider, configs); - }); - it('should emit orderState when watching at 1 confirmation deep and event is one block deep', - (done: DoneCallback) => { - (async () => { - fillScenarios = new FillScenarios( - zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress, - ); - - signedOrder = await fillScenarios.createFillableSignedOrderAsync( - makerToken.address, takerToken.address, maker, taker, fillableAmount, - ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - zeroEx.orderStateWatcher.addOrder(signedOrder); - const callback = reportCallbackErrors(done)((orderState: OrderState) => { - expect(orderState.isValid).to.be.false(); - const invalidOrderState = orderState as OrderStateInvalid; - expect(invalidOrderState.orderHash).to.be.equal(orderHash); - expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance); - done(); - }); - zeroEx.orderStateWatcher.subscribe(callback); - - const anyRecipient = taker; - const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker); - await zeroEx.token.transferAsync(makerToken.address, maker, anyRecipient, makerBalance); - blockchainLifecycle.mineABlock(); - })().catch(done); - }); - it('shouldn\'t emit orderState when watching at 1 confirmation deep and event is in mempool', - (done: DoneCallback) => { - (async () => { - fillScenarios = new FillScenarios( - zeroEx, userAddresses, tokens, zrxTokenAddress, exchangeContractAddress, - ); - - signedOrder = await fillScenarios.createFillableSignedOrderAsync( - makerToken.address, takerToken.address, maker, taker, fillableAmount, - ); - const orderHash = ZeroEx.getOrderHashHex(signedOrder); - zeroEx.orderStateWatcher.addOrder(signedOrder); - const callback = reportCallbackErrors(done)((orderState: OrderState) => { - throw new Error('OrderState callback fired when it shouldn\'t have'); - }); - zeroEx.orderStateWatcher.subscribe(callback); - - const anyRecipient = taker; - const makerBalance = await zeroEx.token.getBalanceAsync(makerToken.address, maker); - await zeroEx.token.transferAsync(makerToken.address, maker, anyRecipient, makerBalance); - setTimeout(() => { - done(); - }, TIMEOUT_MS); - })().catch(done); - }); - }); }); }); |