refactor tests for new constructor pattern
This commit is contained in:
@@ -2,7 +2,6 @@ import { AccountAssetClient } from '../../src/';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Account Asset REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Account Asset REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new AccountAssetClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new AccountAssetClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
it('getInternalTransfers()', async () => {
|
||||
expect(await api.getInternalTransfers()).toMatchObject(
|
||||
|
||||
@@ -2,11 +2,14 @@ import { AccountAssetClient } from '../../src';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Public Account Asset REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new AccountAssetClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new AccountAssetClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
it('getSupportedDepositList()', async () => {
|
||||
expect(await api.getSupportedDepositList()).toMatchObject(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { API_ERROR_CODE, CopyTradingClient } from '../../src';
|
||||
|
||||
describe('Private Copy Trading REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -10,7 +9,11 @@ describe('Private Copy Trading REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new CopyTradingClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new CopyTradingClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
// Don't have copy trading properly enabled on the test account, so testing is very light
|
||||
// (just make sure auth works and endpoint doesn't throw)
|
||||
|
||||
@@ -2,11 +2,14 @@ import { CopyTradingClient } from '../../src';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Public Copy Trading REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new CopyTradingClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new CopyTradingClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
it('getSymbols()', async () => {
|
||||
expect(await api.getSymbols()).toMatchObject({
|
||||
|
||||
@@ -2,11 +2,14 @@ import { InverseFuturesClient } from '../../src/inverse-futures-client';
|
||||
import { successResponseList, successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse-Futures REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
const api = new InverseFuturesClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new InverseFuturesClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
// Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol!
|
||||
const symbol = 'BTCUSDU22';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { API_ERROR_CODE, InverseFuturesClient } from '../../src';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse-Futures REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Inverse-Futures REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new InverseFuturesClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new InverseFuturesClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
// Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol!
|
||||
const symbol = 'BTCUSDU22';
|
||||
|
||||
@@ -6,8 +6,7 @@ import {
|
||||
} from '../response.util';
|
||||
|
||||
describe('Public Inverse-Futures REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const api = new InverseFuturesClient(undefined, undefined, useLivenet);
|
||||
const api = new InverseFuturesClient();
|
||||
|
||||
const symbol = 'BTCUSD';
|
||||
const interval = '15';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { InverseClient } from '../../src/';
|
||||
import { successResponseList, successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Inverse REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new InverseClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new InverseClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSD';
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import { InverseClient } from '../../src/inverse-client';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Inverse REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -12,7 +11,11 @@ describe('Private Inverse REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new InverseClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new InverseClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSD';
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ import {
|
||||
} from '../response.util';
|
||||
|
||||
describe('Public Inverse REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const api = new InverseClient(undefined, undefined, useLivenet);
|
||||
const api = new InverseClient();
|
||||
|
||||
const symbol = 'BTCUSD';
|
||||
const interval = '15';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { LinearClient } from '../../src/linear-client';
|
||||
import { successResponseList, successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Linear REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Linear REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new LinearClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new LinearClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { API_ERROR_CODE, LinearClient } from '../../src';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Linear REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Linear REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new LinearClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new LinearClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
// Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol!
|
||||
const symbol = 'BTCUSDT';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { SpotClient } from '../../src';
|
||||
import { errorResponseObject, successResponseList } from '../response.util';
|
||||
|
||||
describe('Private Spot REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Spot REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new SpotClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new SpotClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
it('getOrder()', async () => {
|
||||
// No auth error == test pass
|
||||
|
||||
@@ -2,7 +2,6 @@ import { API_ERROR_CODE, SpotClient } from '../../src';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Spot REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Spot REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new SpotClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new SpotClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
// Warning: if some of these start to fail with 10001 params error, it's probably that this future expired and a newer one exists with a different symbol!
|
||||
const symbol = 'BTCUSDT';
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
} from '../response.util';
|
||||
|
||||
describe('Private Spot REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -15,7 +14,11 @@ describe('Private Spot REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new SpotClientV3(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new SpotClientV3({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const interval = '15m';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { API_ERROR_CODE, SpotClientV3 } from '../../src';
|
||||
import { successResponseObjectV3 } from '../response.util';
|
||||
|
||||
describe('Private Spot REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Spot REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new SpotClientV3(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new SpotClientV3({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const ltCode = 'BTC3S';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { API_ERROR_CODE, UnifiedMarginClient } from '../../src';
|
||||
import { successResponseObjectV3 } from '../response.util';
|
||||
|
||||
describe('Private Unified Margin REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private Unified Margin REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new UnifiedMarginClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new UnifiedMarginClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const category = 'linear';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { API_ERROR_CODE, UnifiedMarginClient } from '../../src';
|
||||
|
||||
describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -10,7 +9,11 @@ describe('Private Unified Margin REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new UnifiedMarginClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new UnifiedMarginClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const category = 'linear';
|
||||
|
||||
@@ -5,11 +5,14 @@ import {
|
||||
} from '../response.util';
|
||||
|
||||
describe('Public Unified Margin REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new UnifiedMarginClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new UnifiedMarginClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const category = 'linear';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { USDCOptionClient } from '../../../src';
|
||||
import { successResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Options REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
const symbol = 'BTC-30SEP22-400000-C';
|
||||
@@ -12,7 +11,11 @@ describe('Private USDC Options REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCOptionClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new USDCOptionClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const category = 'OPTION';
|
||||
|
||||
it('getActiveRealtimeOrders()', async () => {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { API_ERROR_CODE, USDCOptionClient } from '../../../src';
|
||||
import { successResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private USDC Options REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCOptionClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new USDCOptionClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const currency = 'USDC';
|
||||
const symbol = 'BTC-30SEP22-400000-C';
|
||||
|
||||
@@ -5,11 +5,14 @@ import {
|
||||
} from '../../response.util';
|
||||
|
||||
describe('Public USDC Options REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new USDCOptionClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new USDCOptionClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
const symbol = 'BTC-30SEP22-400000-C';
|
||||
|
||||
it('getOrderBook()', async () => {
|
||||
|
||||
@@ -2,7 +2,6 @@ import { USDCPerpetualClient } from '../../../src';
|
||||
import { successResponseObjectV3 } from '../../response.util';
|
||||
|
||||
describe('Private USDC Perp REST API GET Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -11,7 +10,11 @@ describe('Private USDC Perp REST API GET Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCPerpetualClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new USDCPerpetualClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCPERP';
|
||||
const category = 'PERPETUAL';
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
} from '../../response.util';
|
||||
|
||||
describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = process.env.API_KEY_COM;
|
||||
const API_SECRET = process.env.API_SECRET_COM;
|
||||
|
||||
@@ -14,7 +13,11 @@ describe('Private USDC Perp REST API POST Endpoints', () => {
|
||||
expect(API_SECRET).toStrictEqual(expect.any(String));
|
||||
});
|
||||
|
||||
const api = new USDCPerpetualClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new USDCPerpetualClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCPERP';
|
||||
|
||||
|
||||
@@ -5,11 +5,14 @@ import {
|
||||
} from '../../response.util';
|
||||
|
||||
describe('Public USDC Perp REST API Endpoints', () => {
|
||||
const useLivenet = true;
|
||||
const API_KEY = undefined;
|
||||
const API_SECRET = undefined;
|
||||
|
||||
const api = new USDCPerpetualClient(API_KEY, API_SECRET, useLivenet);
|
||||
const api = new USDCPerpetualClient({
|
||||
key: API_KEY,
|
||||
secret: API_SECRET,
|
||||
testnet: false,
|
||||
});
|
||||
|
||||
const symbol = 'BTCPERP';
|
||||
const category = 'PERPETUAL';
|
||||
|
||||
Reference in New Issue
Block a user