chore(): route tests via proxy instead of github CI address
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { API_ERROR_CODE, UnifiedMarginClient } from '../../src';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import { successResponseObjectV3 } from '../response.util';
|
||||
|
||||
describe('Private Unified Margin REST API GET Endpoints', () => {
|
||||
@@ -10,24 +11,27 @@ describe('Private Unified Margin REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new UnifiedMarginClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
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: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('getHistoricOrders()', async () => {
|
||||
expect(await api.getHistoricOrders({ category })).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,68 +39,68 @@ describe('Private Unified Margin REST API GET Endpoints', () => {
|
||||
const cursor =
|
||||
'fb56c285-02ac-424e-a6b1-d10413b65fab%3A1668178953132%2Cfb56c285-02ac-424e-a6b1-d10413b65fab%3A1668178953132';
|
||||
expect(await api.getHistoricOrders({ category, cursor })).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
// retMsg: expect.stringMatching(/not.*unified margin/gim),
|
||||
});
|
||||
});
|
||||
|
||||
it('getPositions()', async () => {
|
||||
expect(await api.getPositions({ category })).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('get7DayTradingHistory()', async () => {
|
||||
expect(await api.get7DayTradingHistory({ category, symbol })).toMatchObject(
|
||||
{
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
}
|
||||
retCode: expect.any(Number),
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it('getOptionsSettlementHistory()', async () => {
|
||||
expect(await api.getOptionsSettlementHistory({ category })).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('getUSDCPerpetualSettlementHistory()', async () => {
|
||||
expect(
|
||||
await api.getUSDCPerpetualSettlementHistory({ category })
|
||||
await api.getUSDCPerpetualSettlementHistory({ category }),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('getBalances()', async () => {
|
||||
expect(await api.getBalances()).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('getTransactionLog()', async () => {
|
||||
expect(
|
||||
await api.getTransactionLog({ category, currency: 'USDT' })
|
||||
await api.getTransactionLog({ category, currency: 'USDT' }),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('getCoinExchangeHistory()', async () => {
|
||||
expect(await api.getCoinExchangeHistory()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getBorrowHistory()', async () => {
|
||||
expect(await api.getBorrowHistory()).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('getBorrowRate()', async () => {
|
||||
expect(await api.getBorrowRate()).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { API_ERROR_CODE, UnifiedMarginClient } from '../../src';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
|
||||
describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
@@ -9,11 +10,14 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new UnifiedMarginClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new UnifiedMarginClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const category = 'linear';
|
||||
@@ -50,7 +54,7 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
price: '20000',
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -63,7 +67,7 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
orderFilter: 'Order',
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -96,7 +100,7 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
},
|
||||
]),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -120,7 +124,7 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
},
|
||||
]),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -141,37 +145,37 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
},
|
||||
]),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('cancelAllOrders()', async () => {
|
||||
expect(await api.cancelAllOrders({ category })).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('setLeverage()', async () => {
|
||||
expect(await api.setLeverage(category, symbol, 5, 5)).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('setTPSLMode()', async () => {
|
||||
expect(await api.setTPSLMode(category, symbol, 1)).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('setRiskLimit()', async () => {
|
||||
expect(await api.setRiskLimit(category, symbol, 1, 0)).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
it('setTPSL()', async () => {
|
||||
expect(await api.setTPSL({ category, symbol })).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ACCOUNT_NOT_UNIFIED,
|
||||
retCode: expect.any(Number),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { UMCandlesRequest, UnifiedMarginClient } from '../../src';
|
||||
import { getTestProxy } from '../proxy.util';
|
||||
import {
|
||||
successResponseObject,
|
||||
successResponseObjectV3,
|
||||
@@ -8,11 +9,14 @@ describe('Public Unified Margin REST API Endpoints', () => {
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new UnifiedMarginClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new UnifiedMarginClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const category = 'linear';
|
||||
@@ -30,37 +34,37 @@ describe('Public Unified Margin REST API Endpoints', () => {
|
||||
|
||||
it('getOrderBook()', async () => {
|
||||
expect(await api.getOrderBook(symbol, category)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getCandles()', async () => {
|
||||
expect(await api.getCandles(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getSymbolTicker()', async () => {
|
||||
expect(await api.getSymbolTicker(category)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getInstrumentInfo()', async () => {
|
||||
expect(await api.getInstrumentInfo({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getMarkPrice()', async () => {
|
||||
expect(await api.getMarkPriceCandles(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getIndexPrice()', async () => {
|
||||
expect(await api.getIndexPriceCandles(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -69,31 +73,31 @@ describe('Public Unified Margin REST API Endpoints', () => {
|
||||
await api.getFundingRateHistory({
|
||||
category,
|
||||
symbol,
|
||||
})
|
||||
}),
|
||||
).toMatchObject(successResponseObjectV3());
|
||||
});
|
||||
|
||||
it('getRiskLimit()', async () => {
|
||||
expect(await api.getRiskLimit(category, symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getOptionDeliveryPrice()', async () => {
|
||||
expect(await api.getOptionDeliveryPrice({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getTrades()', async () => {
|
||||
expect(await api.getTrades({ category, symbol })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getOpenInterest()', async () => {
|
||||
expect(
|
||||
await api.getOpenInterest({ symbol, category, interval: '5min' })
|
||||
await api.getOpenInterest({ symbol, category, interval: '5min' }),
|
||||
).toMatchObject(successResponseObjectV3());
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user