chore(): update tests for compatibility with new testing sub account
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { AccountAssetClient } from '../../src/';
|
||||
import { API_ERROR_CODE, AccountAssetClient } from '../../src/';
|
||||
import { successResponseObject } from '../response.util';
|
||||
|
||||
describe('Private Account Asset REST API GET Endpoints', () => {
|
||||
@@ -18,53 +18,58 @@ describe('Private Account Asset REST API GET Endpoints', () => {
|
||||
|
||||
it('getInternalTransfers()', async () => {
|
||||
expect(await api.getInternalTransfers()).toMatchObject(
|
||||
successResponseObject()
|
||||
successResponseObject(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getSubAccountTransfers()', async () => {
|
||||
expect(await api.getSubAccountTransfers()).toMatchObject(
|
||||
successResponseObject()
|
||||
);
|
||||
expect(await api.getSubAccountTransfers()).toMatchObject({
|
||||
...successResponseObject(),
|
||||
ret_code: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getSubAccounts()', async () => {
|
||||
expect(await api.getSubAccounts()).toMatchObject(successResponseObject());
|
||||
expect(await api.getSubAccounts()).toMatchObject({
|
||||
...successResponseObject(),
|
||||
ret_code: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getUniversalTransfers()', async () => {
|
||||
expect(await api.getInternalTransfers()).toMatchObject(
|
||||
successResponseObject()
|
||||
successResponseObject(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getDepositRecords()', async () => {
|
||||
expect(await api.getDepositRecords()).toMatchObject(
|
||||
successResponseObject()
|
||||
successResponseObject(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getWithdrawRecords()', async () => {
|
||||
expect(await api.getWithdrawRecords()).toMatchObject(
|
||||
successResponseObject()
|
||||
successResponseObject(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getCoinInformation()', async () => {
|
||||
expect(await api.getCoinInformation()).toMatchObject(
|
||||
successResponseObject()
|
||||
successResponseObject(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getAssetInformation()', async () => {
|
||||
expect(await api.getAssetInformation()).toMatchObject(
|
||||
successResponseObject()
|
||||
successResponseObject(),
|
||||
);
|
||||
});
|
||||
|
||||
it('getDepositAddress()', async () => {
|
||||
expect(await api.getDepositAddress('BTC')).toMatchObject(
|
||||
successResponseObject()
|
||||
);
|
||||
expect(await api.getDepositAddress('BTC')).toMatchObject({
|
||||
...successResponseObject(),
|
||||
ret_code: API_ERROR_CODE.NOT_SUPPORTED_FOR_SUBACCOUNTS,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AccountAssetClientV3 } from '../../src';
|
||||
import { API_ERROR_CODE, AccountAssetClientV3 } from '../../src';
|
||||
import { successResponseObjectV3 } from '../response.util';
|
||||
|
||||
// Only some minimal coverage for v3 apis, since v5 apis are already available
|
||||
@@ -27,24 +27,29 @@ describe('Private Account Asset V3 REST API Endpoints', () => {
|
||||
expect(
|
||||
await api.getInternalTransfers({
|
||||
coin: coin,
|
||||
})
|
||||
}),
|
||||
).toMatchObject(successResponseObjectV3());
|
||||
});
|
||||
|
||||
it('getSubAccountTransfers()', async () => {
|
||||
expect(await api.getSubAccountTransfers()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
);
|
||||
expect(await api.getSubAccountTransfers()).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getSubAccounts()', async () => {
|
||||
expect(await api.getSubAccounts()).toMatchObject(successResponseObjectV3());
|
||||
expect(await api.getSubAccounts()).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getUniversalTransfers()', async () => {
|
||||
expect(await api.getUniversalTransfers({ coin: coin })).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
);
|
||||
expect(await api.getUniversalTransfers({ coin: coin })).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getTransferableCoinList()', async () => {
|
||||
@@ -52,7 +57,7 @@ describe('Private Account Asset V3 REST API Endpoints', () => {
|
||||
await api.getTransferableCoinList({
|
||||
fromAccountType: 'SPOT',
|
||||
toAccountType: 'CONTRACT',
|
||||
})
|
||||
}),
|
||||
).toMatchObject(successResponseObjectV3());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('Private Contract REST API GET Endpoints', () => {
|
||||
});
|
||||
|
||||
// Doesn't work on e2e test account. This endpoint throws this error if the account never opened a position before.
|
||||
it('getOpenInterestLimitInfo()', async () => {
|
||||
it.skip('getOpenInterestLimitInfo()', async () => {
|
||||
expect(await api.getOpenInterestLimitInfo('ETHUSDT')).toMatchObject({
|
||||
retCode: API_ERROR_CODE.PARAMS_MISSING_OR_WRONG,
|
||||
retMsg: expect.stringMatching(/OI group don't exist/gim),
|
||||
|
||||
@@ -20,22 +20,26 @@ describe('Private Copy Trading REST API GET Endpoints', () => {
|
||||
// (just make sure auth works and endpoint doesn't throw)
|
||||
|
||||
it('getActiveOrders()', async () => {
|
||||
expect(await api.getActiveOrders()).toMatchObject(
|
||||
successResponseObjectV3()
|
||||
);
|
||||
expect(await api.getActiveOrders()).toMatchObject({
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getPositions()', async () => {
|
||||
expect(await api.getPositions()).toMatchObject(successResponseObjectV3());
|
||||
expect(await api.getPositions()).toMatchObject({
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getBalances()', async () => {
|
||||
expect(await api.getBalances()).toMatchObject(successResponseObjectV3());
|
||||
expect(await api.getBalances()).toMatchObject({
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('closePosition()', async () => {
|
||||
expect(await api.closePosition('SOLUSDT', '1')).toMatchObject({
|
||||
retCode: API_ERROR_CODE.COPY_TRADE_NOT_OPEN_ORDER,
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -185,12 +185,14 @@ describe('Private READ V5 REST API Endpoints', () => {
|
||||
it('getSubUID()', async () => {
|
||||
expect(await api.getSubUID()).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
it('getUniversalTransferRecords()', async () => {
|
||||
expect(await api.getUniversalTransferRecords()).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -216,7 +218,8 @@ describe('Private READ V5 REST API Endpoints', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('getMasterDepositAddress()', async () => {
|
||||
// Not available for sub accounts
|
||||
it.skip('getMasterDepositAddress()', async () => {
|
||||
expect(await api.getMasterDepositAddress(settleCoin)).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
});
|
||||
|
||||
@@ -247,7 +247,7 @@ describe('Private WRITE V5 REST API Endpoints', () => {
|
||||
).toMatchObject({
|
||||
// ...successResponseObjectV3(),
|
||||
// retMsg: '',
|
||||
retCode: API_ERROR_CODE.V5_RISK_ID_NOT_CHANGED,
|
||||
retCode: API_ERROR_CODE.V5_RISK_ID_NOT_MODIFIED,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -338,6 +338,7 @@ describe('Private WRITE V5 REST API Endpoints', () => {
|
||||
it('enableUniversalTransferForSubUIDs()', async () => {
|
||||
expect(await api.enableUniversalTransferForSubUIDs([])).toMatchObject({
|
||||
...successResponseObjectV3(),
|
||||
retCode: API_ERROR_CODE.INCORRECT_API_KEY_PERMISSIONS,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -385,7 +386,8 @@ describe('Private WRITE V5 REST API Endpoints', () => {
|
||||
});
|
||||
|
||||
describe('User APIs', () => {
|
||||
it('createSubMember()', async () => {
|
||||
// Not available on sub account
|
||||
it.skip('createSubMember()', async () => {
|
||||
expect(
|
||||
await api.createSubMember({
|
||||
memberType: 1,
|
||||
|
||||
Reference in New Issue
Block a user