chore(): update tests for compatibility with new testing sub account

This commit is contained in:
tiagosiebler
2023-05-16 14:48:20 +01:00
parent 065f72472e
commit a5aa7f6cf2
10 changed files with 59 additions and 38 deletions

View File

@@ -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,
});
});
});

View File

@@ -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());
});
});