waves-transactions icon indicating copy to clipboard operation
waves-transactions copied to clipboard

[matcher.test.ts] Testing "Cancelling a market order" should not be a test as by definition you are buying into the slippage

Open xucito opened this issue 6 years ago • 0 comments

Cancelling a market order should not be a test as by definition you are buying into the slippage.

Only way to make this test pass is by configuring matcher to break the market (No seller side)

 it('should submit and cancel market order', async () => {
    const oParams = {
      orderType: 'buy' as 'buy',
      matcherPublicKey: MATCHER_PUBLIC_KEY,
      price: 10000000000000,
      amount: 1000,
      matcherFee: 8000000,
      priceAsset: null,
      amountAsset: assetId
    }

    const ord = order(oParams, MASTER_SEED)
    const submitResp = await submitOrder(ord, {market: true, matcherUrl: MATCHER_URL})
    expect(submitResp.status).toEqual('OrderAccepted')

    const co = cancelOrder({ orderId: ord.id }, MASTER_SEED)
    const cancelResp = await cancelSubmittedOrder(co, ord.assetPair.amountAsset, ord.assetPair.priceAsset, MATCHER_URL)
    expect(cancelResp.status).toEqual('OrderCanceled')
  }, TIMEOUT)

xucito avatar Jan 24 '20 00:01 xucito