From 1fd2ad482d2bda5f99952e506d0b689cba1647aa Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Sat, 30 Mar 2024 10:11:08 +0000 Subject: [PATCH] chore(): remove UM tests covering dead endpoints, fix v5 test --- test/unified-margin/private.read.test.ts | 106 ----------------------- test/v5/private.write.test.ts | 4 +- 2 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 test/unified-margin/private.read.test.ts diff --git a/test/unified-margin/private.read.test.ts b/test/unified-margin/private.read.test.ts deleted file mode 100644 index b79a581..0000000 --- a/test/unified-margin/private.read.test.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { UnifiedMarginClient } from '../../src'; -import { getTestProxy } from '../proxy.util'; -import { successResponseObjectV3 } from '../response.util'; - -describe('Private Unified Margin REST API GET Endpoints', () => { - const API_KEY = process.env.API_KEY_COM; - const API_SECRET = process.env.API_SECRET_COM; - - it('should have api credentials to test with', () => { - expect(API_KEY).toStrictEqual(expect.any(String)); - expect(API_SECRET).toStrictEqual(expect.any(String)); - }); - - const api = new UnifiedMarginClient( - { - key: API_KEY, - secret: API_SECRET, - testnet: false, - }, - getTestProxy(), - ); - - const symbol = 'BTCUSDT'; - const category = 'linear'; - - it('getActiveOrders()', async () => { - expect(await api.getActiveOrders({ category })).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getHistoricOrders()', async () => { - expect(await api.getHistoricOrders({ category })).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getHistoricOrders() with cursor', async () => { - const cursor = - 'fb56c285-02ac-424e-a6b1-d10413b65fab%3A1668178953132%2Cfb56c285-02ac-424e-a6b1-d10413b65fab%3A1668178953132'; - expect(await api.getHistoricOrders({ category, cursor })).toMatchObject({ - retCode: expect.any(Number), - // retMsg: expect.stringMatching(/not.*unified margin/gim), - }); - }); - - it('getPositions()', async () => { - expect(await api.getPositions({ category })).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('get7DayTradingHistory()', async () => { - expect(await api.get7DayTradingHistory({ category, symbol })).toMatchObject( - { - retCode: expect.any(Number), - }, - ); - }); - - it('getOptionsSettlementHistory()', async () => { - expect(await api.getOptionsSettlementHistory({ category })).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getUSDCPerpetualSettlementHistory()', async () => { - expect( - await api.getUSDCPerpetualSettlementHistory({ category }), - ).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getBalances()', async () => { - expect(await api.getBalances()).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getTransactionLog()', async () => { - expect( - await api.getTransactionLog({ category, currency: 'USDT' }), - ).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getCoinExchangeHistory()', async () => { - expect(await api.getCoinExchangeHistory()).toMatchObject( - successResponseObjectV3(), - ); - }); - - it('getBorrowHistory()', async () => { - expect(await api.getBorrowHistory()).toMatchObject({ - retCode: expect.any(Number), - }); - }); - - it('getBorrowRate()', async () => { - expect(await api.getBorrowRate()).toMatchObject({ - retCode: expect.any(Number), - }); - }); -}); diff --git a/test/v5/private.write.test.ts b/test/v5/private.write.test.ts index 1f1a154..24bed98 100644 --- a/test/v5/private.write.test.ts +++ b/test/v5/private.write.test.ts @@ -446,7 +446,7 @@ describe('Private WRITE V5 REST API Endpoints', () => { }), ).toMatchObject({ // ...successResponseObjectV3(), - retCode: API_ERROR_CODE.SPOT_LEVERAGE_QUIZ_REQUIRED, + retCode: 175025, // retMsg: '', }); }); @@ -459,7 +459,7 @@ describe('Private WRITE V5 REST API Endpoints', () => { }), ).toMatchObject({ // ...successResponseObjectV3(), - retCode: API_ERROR_CODE.SPOT_LEVERAGE_TOKEN_INSUFFICIENT_BALANCE, + retCode: 175025, // retMsg: '', }); });