From c8aca710b761f314f6e97507c66e93e1f187b8c9 Mon Sep 17 00:00:00 2001 From: Tiago Siebler Date: Tue, 8 Nov 2022 15:38:12 +0000 Subject: [PATCH] fix tests --- test/futures/private.write.test.ts | 6 ++++-- test/spot/private.write.test.ts | 18 +++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/test/futures/private.write.test.ts b/test/futures/private.write.test.ts index 15a2f61..bc44645 100644 --- a/test/futures/private.write.test.ts +++ b/test/futures/private.write.test.ts @@ -154,9 +154,9 @@ describe('Private Futures REST API POST Endpoints', () => { marginCoin, orderType: 'market', side: 'open_long', - size: '1', + size: '0.1', symbol, - triggerPrice: '100', + triggerPrice: '1000', triggerType: 'market_price', }) ).toMatchObject({ @@ -164,6 +164,8 @@ describe('Private Futures REST API POST Endpoints', () => { data: {}, }); } catch (e) { + // {"code": "40889", "data": null, "msg": "The plan order of this contract has reached the upper limit" + // if the above error is seen, you need to cancel trigger orders on the test account (in futures) console.error('submitPlanOrder: ', e); expect(e).toBeNull(); } diff --git a/test/spot/private.write.test.ts b/test/spot/private.write.test.ts index e04f7ac..280a764 100644 --- a/test/spot/private.write.test.ts +++ b/test/spot/private.write.test.ts @@ -34,16 +34,11 @@ describe('Private Spot REST API POST Endpoints', () => { toType: 'mix_usdt', }) ).toStrictEqual(''); - - // .toMatchObject({ - // // not sure what this error means, probably no balance - // code: '42013', - // }); } catch (e) { // console.error('transfer: ', e); expect(e.body).toMatchObject({ - // not sure what this error means, probably no balance - code: '42013', + // not sure what this error means, probably no balance. Seems to change? + code: expect.stringMatching(/42013|43117/gim), }); } }); @@ -115,12 +110,13 @@ describe('Private Spot REST API POST Endpoints', () => { ]) ).toMatchObject({ ...sucessEmptyResponseObject(), - data: expect.any(Array), + data: { + resultList: expect.any(Array), + failure: [{ errorCode: API_ERROR_CODE.QTY_LESS_THAN_MINIMUM }], + }, }); } catch (e) { - expect(e.body).toMatchObject({ - code: API_ERROR_CODE.QTY_LESS_THAN_MINIMUM, - }); + expect(e).toBeNull(); } });