fix tests
This commit is contained in:
@@ -33,8 +33,10 @@ describe('Private Contract REST API POST Endpoints', () => {
|
|||||||
price: '20000',
|
price: '20000',
|
||||||
orderLinkId: Date.now().toString(),
|
orderLinkId: Date.now().toString(),
|
||||||
timeInForce: 'GoodTillCancel',
|
timeInForce: 'GoodTillCancel',
|
||||||
|
positionIdx: '2',
|
||||||
})
|
})
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
|
// retMsg: '',
|
||||||
retCode: API_ERROR_CODE.CONTRACT_INSUFFICIENT_BALANCE,
|
retCode: API_ERROR_CODE.CONTRACT_INSUFFICIENT_BALANCE,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -74,6 +76,7 @@ describe('Private Contract REST API POST Endpoints', () => {
|
|||||||
autoAddMargin: 0,
|
autoAddMargin: 0,
|
||||||
side: 'Buy',
|
side: 'Buy',
|
||||||
symbol,
|
symbol,
|
||||||
|
positionIdx: 1,
|
||||||
})
|
})
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
retMsg: expect.stringMatching(/not modified/gim),
|
retMsg: expect.stringMatching(/not modified/gim),
|
||||||
@@ -98,7 +101,7 @@ describe('Private Contract REST API POST Endpoints', () => {
|
|||||||
expect(
|
expect(
|
||||||
await api.setPositionMode({
|
await api.setPositionMode({
|
||||||
symbol,
|
symbol,
|
||||||
mode: 0,
|
mode: 3,
|
||||||
})
|
})
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
retCode: API_ERROR_CODE.CONTRACT_POSITION_MODE_NOT_MODIFIED,
|
retCode: API_ERROR_CODE.CONTRACT_POSITION_MODE_NOT_MODIFIED,
|
||||||
@@ -120,7 +123,7 @@ describe('Private Contract REST API POST Endpoints', () => {
|
|||||||
|
|
||||||
it('setTPSL()', async () => {
|
it('setTPSL()', async () => {
|
||||||
expect(
|
expect(
|
||||||
await api.setTPSL({ symbol, positionIdx: 0, stopLoss: '100' })
|
await api.setTPSL({ symbol, positionIdx: 1, stopLoss: '100' })
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
retMsg: expect.stringMatching(/zero position/gim),
|
retMsg: expect.stringMatching(/zero position/gim),
|
||||||
retCode: API_ERROR_CODE.PARAMS_MISSING_OR_WRONG,
|
retCode: API_ERROR_CODE.PARAMS_MISSING_OR_WRONG,
|
||||||
@@ -128,7 +131,8 @@ describe('Private Contract REST API POST Endpoints', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('setRiskLimit()', async () => {
|
it('setRiskLimit()', async () => {
|
||||||
expect(await api.setRiskLimit(symbol, 43, 0)).toMatchObject({
|
expect(await api.setRiskLimit(symbol, 43, 2)).toMatchObject({
|
||||||
|
// retMsg: '',
|
||||||
retCode: API_ERROR_CODE.CONTRACT_RISK_LIMIT_INFO_NOT_EXISTS,
|
retCode: API_ERROR_CODE.CONTRACT_RISK_LIMIT_INFO_NOT_EXISTS,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ describe('Private Contract Websocket Client', () => {
|
|||||||
secret: API_SECRET,
|
secret: API_SECRET,
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
wsClient = new WebsocketClient(
|
wsClient = new WebsocketClient(
|
||||||
wsClientOptions,
|
wsClientOptions,
|
||||||
getSilentLogger('expectSuccessNoAuth')
|
getSilentLogger('expectSuccessNoAuth')
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ describe('Private Linear REST API POST Endpoints', () => {
|
|||||||
margin: 5,
|
margin: 5,
|
||||||
})
|
})
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
ret_code: API_ERROR_CODE.POSITION_SIZE_IS_ZERO,
|
ret_code: API_ERROR_CODE.ISOLATED_NOT_MODIFIED_LINEAR,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user