chore(): route tests via proxy instead of github CI address
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { USDCOptionClient } from '../../../src';
|
||||
import { getTestProxy } from '../../proxy.util';
|
||||
import { successResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Options REST API GET Endpoints', () => {
|
||||
@@ -11,40 +12,43 @@ describe('Private USDC Options REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCOptionClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new USDCOptionClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
const category = 'OPTION';
|
||||
|
||||
it('getActiveRealtimeOrders()', async () => {
|
||||
expect(await api.getActiveRealtimeOrders()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getActiveOrders()', async () => {
|
||||
expect(await api.getActiveOrders({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getHistoricOrders()', async () => {
|
||||
expect(await api.getHistoricOrders({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getOrderExecutionHistory()', async () => {
|
||||
expect(await api.getOrderExecutionHistory({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getTransactionLog()', async () => {
|
||||
expect(await api.getTransactionLog({ type: 'TRADE' })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -62,19 +66,19 @@ describe('Private USDC Options REST API GET Endpoints', () => {
|
||||
|
||||
it('getPositions()', async () => {
|
||||
expect(await api.getPositions({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getDeliveryHistory()', async () => {
|
||||
expect(await api.getDeliveryHistory({ symbol })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getPositionsInfoUponExpiry()', async () => {
|
||||
expect(await api.getPositionsInfoUponExpiry()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { API_ERROR_CODE, USDCOptionClient } from '../../../src';
|
||||
import { getTestProxy } from '../../proxy.util';
|
||||
// import { successResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
@@ -10,11 +11,14 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCOptionClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new USDCOptionClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
|
||||
const currency = 'USDC';
|
||||
const symbol = 'BTC-30SEP22-400000-C';
|
||||
@@ -29,7 +33,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
orderPrice: '40',
|
||||
orderLinkId: Date.now().toString(),
|
||||
timeInForce: 'GoodTillCancel',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.CONTRACT_NAME_NOT_EXIST,
|
||||
});
|
||||
@@ -56,7 +60,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
orderLinkId: Date.now().toString(),
|
||||
timeInForce: 'GoodTillCancel',
|
||||
},
|
||||
])
|
||||
]),
|
||||
).toMatchObject({
|
||||
result: [
|
||||
{ errorCode: API_ERROR_CODE.CONTRACT_NAME_NOT_EXIST },
|
||||
@@ -70,7 +74,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
await api.modifyOrder({
|
||||
symbol,
|
||||
orderId: 'somethingFake',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.CONTRACT_NAME_NOT_EXIST,
|
||||
});
|
||||
@@ -87,7 +91,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
symbol,
|
||||
orderId: 'somethingFake2',
|
||||
},
|
||||
])
|
||||
]),
|
||||
).toMatchObject({
|
||||
result: [
|
||||
{ errorCode: API_ERROR_CODE.CONTRACT_NAME_NOT_EXIST },
|
||||
@@ -101,7 +105,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
await api.cancelOrder({
|
||||
symbol,
|
||||
orderId: 'somethingFake1',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.CONTRACT_NAME_NOT_EXIST,
|
||||
});
|
||||
@@ -118,7 +122,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
symbol,
|
||||
orderId: 'somethingFake2',
|
||||
},
|
||||
])
|
||||
]),
|
||||
).toMatchObject({
|
||||
result: [
|
||||
{ errorCode: API_ERROR_CODE.CONTRACT_NAME_NOT_EXIST },
|
||||
@@ -138,7 +142,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
expect(await api.setMarginMode('REGULAR_MARGIN')).toMatchObject(
|
||||
{
|
||||
retCode: API_ERROR_CODE.SET_MARGIN_MODE_FAILED_USDC,
|
||||
}
|
||||
},
|
||||
// successResponseObjectV3()
|
||||
);
|
||||
});
|
||||
@@ -151,7 +155,7 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
frozenPeriodMs: 100,
|
||||
qtyLimit: '100',
|
||||
deltaLimit: '1',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.INCORRECT_MMP_PARAMETERS,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { USDCOptionClient } from '../../../src';
|
||||
import { getTestProxy } from '../../proxy.util';
|
||||
import {
|
||||
successResponseObject,
|
||||
successResponseObjectV3,
|
||||
@@ -8,46 +9,49 @@ describe('Public USDC Options REST API Endpoints', () => {
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new USDCOptionClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new USDCOptionClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
const symbol = 'BTC-30SEP22-400000-C';
|
||||
|
||||
it('getOrderBook()', async () => {
|
||||
expect(await api.getOrderBook(symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getContractInfo()', async () => {
|
||||
expect(await api.getContractInfo()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getSymbolTicker()', async () => {
|
||||
expect(await api.getSymbolTicker(symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getDeliveryPrice()', async () => {
|
||||
expect(await api.getDeliveryPrice()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getLast500Trades()', async () => {
|
||||
expect(await api.getLast500Trades({ category: 'OPTION' })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getHistoricalVolatility()', async () => {
|
||||
expect(await api.getHistoricalVolatility()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { USDCPerpetualClient } from '../../../src';
|
||||
import { getTestProxy } from '../../proxy.util';
|
||||
import { successResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Perp REST API GET Endpoints', () => {
|
||||
@@ -10,36 +11,39 @@ describe('Private USDC Perp REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCPerpetualClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new USDCPerpetualClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
|
||||
const symbol = 'BTCPERP';
|
||||
const category = 'PERPETUAL';
|
||||
|
||||
it('getActiveOrders()', async () => {
|
||||
expect(await api.getActiveOrders({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getHistoricOrders()', async () => {
|
||||
expect(await api.getHistoricOrders({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getOrderExecutionHistory()', async () => {
|
||||
expect(await api.getOrderExecutionHistory({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getTransactionLog()', async () => {
|
||||
expect(await api.getTransactionLog({ type: 'TRADE' })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -57,19 +61,19 @@ describe('Private USDC Perp REST API GET Endpoints', () => {
|
||||
|
||||
it('getPositions()', async () => {
|
||||
expect(await api.getPositions({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getSettlementHistory()', async () => {
|
||||
expect(await api.getSettlementHistory({ symbol })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getPredictedFundingRate()', async () => {
|
||||
expect(await api.getPredictedFundingRate(symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { API_ERROR_CODE, USDCPerpetualClient } from '../../../src';
|
||||
import { getTestProxy } from '../../proxy.util';
|
||||
import { successEmptyResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
@@ -10,11 +11,14 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCPerpetualClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new USDCPerpetualClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
|
||||
const symbol = 'BTCPERP';
|
||||
|
||||
@@ -29,7 +33,7 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
orderPrice: '20000',
|
||||
orderLinkId: Date.now().toString(),
|
||||
timeInForce: 'GoodTillCancel',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.INSUFFICIENT_BALANCE_FOR_ORDER_COST,
|
||||
});
|
||||
@@ -42,7 +46,7 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
orderId: 'somethingFake',
|
||||
orderPrice: '20000',
|
||||
orderFilter: 'Order',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ORDER_NOT_FOUND_OR_TOO_LATE,
|
||||
});
|
||||
@@ -54,7 +58,7 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
symbol,
|
||||
orderId: 'somethingFake1',
|
||||
orderFilter: 'Order',
|
||||
})
|
||||
}),
|
||||
).toMatchObject({
|
||||
retCode: API_ERROR_CODE.ORDER_NOT_FOUND_OR_TOO_LATE,
|
||||
});
|
||||
@@ -62,7 +66,7 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
|
||||
it('cancelActiveOrders()', async () => {
|
||||
expect(await api.cancelActiveOrders(symbol, 'Order')).toMatchObject(
|
||||
successEmptyResponseObjectV3()
|
||||
successEmptyResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -72,7 +76,7 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
{
|
||||
retCode: API_ERROR_CODE.SET_MARGIN_MODE_FAILED_USDC,
|
||||
retMsg: '',
|
||||
}
|
||||
},
|
||||
// successResponseObjectV3()
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3,16 +3,20 @@ import {
|
||||
successResponseObject,
|
||||
successResponseObjectV3,
|
||||
} from '../../response.util';
|
||||
import { getTestProxy } from '../../proxy.util';
|
||||
|
||||
describe('Public USDC Perp REST API Endpoints', () => {
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new USDCPerpetualClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const api = new USDCPerpetualClient(
|
||||
{
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
},
|
||||
getTestProxy(),
|
||||
);
|
||||
|
||||
const symbol = 'BTCPERP';
|
||||
const category = 'PERPETUAL';
|
||||
@@ -22,73 +26,73 @@ describe('Public USDC Perp REST API Endpoints', () => {
|
||||
|
||||
it('getOrderBook()', async () => {
|
||||
expect(await api.getOrderBook(symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getContractInfo()', async () => {
|
||||
expect(await api.getContractInfo()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getSymbolTicker()', async () => {
|
||||
expect(await api.getSymbolTicker(symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getCandles()', async () => {
|
||||
expect(await api.getCandles(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getMarkPrice()', async () => {
|
||||
expect(await api.getMarkPrice(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getIndexPrice()', async () => {
|
||||
expect(await api.getIndexPrice(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getIndexPremium()', async () => {
|
||||
expect(await api.getIndexPremium(candleRequest)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getOpenInterest()', async () => {
|
||||
expect(await api.getOpenInterest({ symbol, period: '1m' })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getLargeOrders()', async () => {
|
||||
expect(await api.getLargeOrders({ symbol })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getLongShortRatio()', async () => {
|
||||
expect(await api.getLongShortRatio({ symbol, period: '1m' })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getLast500Trades()', async () => {
|
||||
expect(await api.getLast500Trades({ category })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getLastFundingRate()', async () => {
|
||||
expect(await api.getLastFundingRate(symbol)).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
successResponseObjectV3(),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user