From 26ef7fd834ad396c0218ce5b7c200540c37628fe Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Sat, 12 Nov 2022 12:01:22 +0000 Subject: [PATCH] add private read e2e contract tests --- test/contract/private.read.test.ts | 71 ++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 test/contract/private.read.test.ts diff --git a/test/contract/private.read.test.ts b/test/contract/private.read.test.ts new file mode 100644 index 0000000..c954df5 --- /dev/null +++ b/test/contract/private.read.test.ts @@ -0,0 +1,71 @@ +import { API_ERROR_CODE, ContractClient } from '../../src'; +import { successResponseObjectV3 } from '../response.util'; + +describe('Private Contract 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 ContractClient({ + key: API_KEY, + secret: API_SECRET, + testnet: false, + }); + + const symbol = 'BTCUSDT'; + it('getHistoricOrders()', async () => { + expect(await api.getHistoricOrders({ symbol })).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getActiveOrders()', async () => { + expect(await api.getActiveOrders({ symbol })).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getPositions()', async () => { + expect(await api.getPositions({ symbol })).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getUserExecutionHistory()', async () => { + expect(await api.getUserExecutionHistory({ symbol })).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getClosedProfitAndLoss()', async () => { + expect(await api.getClosedProfitAndLoss({ symbol })).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getOpenInterestLimitInfo()', async () => { + expect(await api.getOpenInterestLimitInfo(symbol)).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getBalances()', async () => { + expect(await api.getBalances()).toMatchObject(successResponseObjectV3()); + }); + + it('getTradingFeeRate()', async () => { + expect(await api.getTradingFeeRate()).toMatchObject( + successResponseObjectV3() + ); + }); + + it('getWalletFundRecords()', async () => { + expect(await api.getWalletFundRecords()).toMatchObject( + successResponseObjectV3() + ); + }); +});