From e9972ef82968dedbbb27b7e5b4562ef0c6a01ef3 Mon Sep 17 00:00:00 2001 From: Tiago Siebler Date: Wed, 22 Mar 2023 17:02:12 +0000 Subject: [PATCH] chore(): lint for trailing commas, fix tests with new types --- examples/rest-trade-futures.ts | 8 ++++---- examples/rest-trade-spot.ts | 2 +- examples/ws-private.ts | 2 +- examples/ws-public.ts | 2 +- src/broker-client.ts | 14 +++++++------- src/util/WsStore.ts | 6 +++--- src/util/browser-support.ts | 8 ++++---- src/util/node-support.ts | 2 +- src/util/requestUtils.ts | 6 +++--- src/util/type-guards.ts | 8 ++++---- src/util/websocket-util.ts | 14 +++++++------- test/broker/private.read.test.ts | 14 +++++++------- test/broker/private.write.test.ts | 16 ++++++++-------- test/futures/private.read.test.ts | 24 ++++++++++++------------ test/futures/private.write.test.ts | 29 +++++++++++++++-------------- test/futures/public.test.ts | 2 +- test/response.util.ts | 4 ++-- test/ws.private.test.ts | 4 ++-- test/ws.public.test.ts | 2 +- test/ws.util.ts | 4 ++-- 20 files changed, 86 insertions(+), 85 deletions(-) diff --git a/examples/rest-trade-futures.ts b/examples/rest-trade-futures.ts index 43dc87a..58ca502 100644 --- a/examples/rest-trade-futures.ts +++ b/examples/rest-trade-futures.ts @@ -47,7 +47,7 @@ function promiseSleep(milliseconds) { // WARNING: for sensitive math you should be using a library such as decimal.js! function roundDown(value, decimals) { return Number( - Math.floor(parseFloat(value + 'e' + decimals)) + 'e-' + decimals + Math.floor(parseFloat(value + 'e' + decimals)) + 'e-' + decimals, ); } @@ -117,7 +117,7 @@ async function handleWsUpdate(event) { const symbolRulesResult = await client.getSymbols('umcbl'); const bitcoinUSDFuturesRule = symbolRulesResult.data.find( - (row) => row.symbol === symbol + (row) => row.symbol === symbol, ); console.log('symbol rules: ', bitcoinUSDFuturesRule); @@ -142,7 +142,7 @@ async function handleWsUpdate(event) { const positionsResult = await client.getPositions('umcbl'); const positionsToClose = positionsResult.data.filter( - (pos) => pos.total !== '0' + (pos) => pos.total !== '0', ); console.log('open positions to close: ', positionsToClose); @@ -167,7 +167,7 @@ async function handleWsUpdate(event) { console.log( 'positions after closing all: ', - await client.getPositions('umcbl') + await client.getPositions('umcbl'), ); } catch (e) { console.error('request failed: ', e); diff --git a/examples/rest-trade-spot.ts b/examples/rest-trade-spot.ts index 02e3441..a990097 100644 --- a/examples/rest-trade-spot.ts +++ b/examples/rest-trade-spot.ts @@ -35,7 +35,7 @@ function promiseSleep(milliseconds) { // WARNING: for sensitive math you should be using a library such as decimal.js! function roundDown(value, decimals) { return Number( - Math.floor(parseFloat(value + 'e' + decimals)) + 'e-' + decimals + Math.floor(parseFloat(value + 'e' + decimals)) + 'e-' + decimals, ); } diff --git a/examples/ws-private.ts b/examples/ws-private.ts index a6356c5..fa74781 100644 --- a/examples/ws-private.ts +++ b/examples/ws-private.ts @@ -22,7 +22,7 @@ import { WebsocketClient, DefaultLogger } from '../src'; // optionally provide rest options, e.g. to pass through a proxy // }, }, - logger + logger, ); wsClient.on('update', (data) => { diff --git a/examples/ws-public.ts b/examples/ws-public.ts index 39c40a2..52a8701 100644 --- a/examples/ws-public.ts +++ b/examples/ws-public.ts @@ -15,7 +15,7 @@ import { DefaultLogger, WS_KEY_MAP, WebsocketClient } from '../src'; // optionally provide rest options, e.g. to pass through a proxy // }, }, - logger + logger, ); wsClient.on('update', (data) => { diff --git a/src/broker-client.ts b/src/broker-client.ts index 5ca8493..d96816b 100644 --- a/src/broker-client.ts +++ b/src/broker-client.ts @@ -30,7 +30,7 @@ export class BrokerClient extends BaseRestClient { /** Create Sub Account */ createSubAccount( subName: string, - remark?: string + remark?: string, ): Promise> { return this.postPrivate('/api/broker/v1/account/sub-create', { subName, @@ -47,7 +47,7 @@ export class BrokerClient extends BaseRestClient { modifySubAccount( subUid: string, perm: string, - status: 'normal' | 'freeze' | 'del' + status: 'normal' | 'freeze' | 'del', ): Promise> { return this.postPrivate('/api/broker/v1/account/sub-modify', { subUid, @@ -79,7 +79,7 @@ export class BrokerClient extends BaseRestClient { /** Get Sub Future Assets */ getSubFutureAssets( subUid: string, - productType: BrokerProductType + productType: BrokerProductType, ): Promise> { return this.getPrivate('/api/broker/v1/account/sub-future-assets', { subUid, @@ -91,7 +91,7 @@ export class BrokerClient extends BaseRestClient { getSubDepositAddress( subUid: string, coin: string, - chain?: string + chain?: string, ): Promise> { return this.postPrivate('/api/broker/v1/account/sub-address', { subUid, @@ -109,7 +109,7 @@ export class BrokerClient extends BaseRestClient { setSubDepositAutoTransfer( subUid: string, coin: string, - toAccountType: 'spot' | 'mix_usdt' | 'mix_usd' | 'mix_usdc' + toAccountType: 'spot' | 'mix_usdt' | 'mix_usd' | 'mix_usdc', ): Promise> { return this.postPrivate('/api/broker/v1/account/sub-auto-transfer', { subUid, @@ -130,7 +130,7 @@ export class BrokerClient extends BaseRestClient { passphrase: string, remark: string, ip: string, - perm?: string + perm?: string, ): Promise> { return this.postPrivate('/api/broker/v1/manage/sub-api-create', { subUid, @@ -148,7 +148,7 @@ export class BrokerClient extends BaseRestClient { /** Modify Sub ApiKey (Only Broker) */ modifySubAPIKey( - params: BrokerSubAPIKeyModifyRequest + params: BrokerSubAPIKeyModifyRequest, ): Promise> { return this.postPrivate('/api/broker/v1/manage/sub-api-modify', params); } diff --git a/src/util/WsStore.ts b/src/util/WsStore.ts index c02e1da..1151dea 100644 --- a/src/util/WsStore.ts +++ b/src/util/WsStore.ts @@ -82,7 +82,7 @@ export default class WsStore { if (this.hasExistingActiveConnection(key)) { this.logger.warning( 'WsStore setConnection() overwriting existing open connection: ', - this.getWs(key) + this.getWs(key), ); } this.wsState[key] = { @@ -98,7 +98,7 @@ export default class WsStore { const ws = this.getWs(key); this.logger.warning( 'WsStore deleting state for connection still open: ', - ws + ws, ); ws?.close(); } @@ -119,7 +119,7 @@ export default class WsStore { if (this.isWsOpen(key)) { this.logger.warning( 'WsStore setConnection() overwriting existing open connection: ', - this.getWs(key) + this.getWs(key), ); } diff --git a/src/util/browser-support.ts b/src/util/browser-support.ts index 8098e72..3633549 100644 --- a/src/util/browser-support.ts +++ b/src/util/browser-support.ts @@ -11,7 +11,7 @@ function _arrayBufferToBase64(buffer: ArrayBuffer) { export async function signMessage( message: string, secret: string, - method: 'hex' | 'base64' + method: 'hex' | 'base64', ): Promise { const encoder = new TextEncoder(); const key = await window.crypto.subtle.importKey( @@ -19,20 +19,20 @@ export async function signMessage( encoder.encode(secret), { name: 'HMAC', hash: { name: 'SHA-256' } }, false, - ['sign'] + ['sign'], ); const signature = await window.crypto.subtle.sign( 'HMAC', key, - encoder.encode(message) + encoder.encode(message), ); switch (method) { case 'hex': { return Array.prototype.map .call(new Uint8Array(signature), (x: any) => - ('00' + x.toString(16)).slice(-2) + ('00' + x.toString(16)).slice(-2), ) .join(''); } diff --git a/src/util/node-support.ts b/src/util/node-support.ts index 3d88b55..4afe4b6 100644 --- a/src/util/node-support.ts +++ b/src/util/node-support.ts @@ -4,7 +4,7 @@ import { createHmac } from 'crypto'; export async function signMessage( message: string, secret: string, - method: 'hex' | 'base64' + method: 'hex' | 'base64', ): Promise { const hmac = createHmac('sha256', secret).update(message); diff --git a/src/util/requestUtils.ts b/src/util/requestUtils.ts index e448bdc..63cc78d 100644 --- a/src/util/requestUtils.ts +++ b/src/util/requestUtils.ts @@ -30,7 +30,7 @@ export interface RestClientOptions { export function serializeParams( params: T, strict_validation = false, - prefixWith: string = '' + prefixWith: string = '', ): string { if (!params) { return ''; @@ -42,7 +42,7 @@ export function serializeParams( const value = params[key]; if (strict_validation === true && typeof value === 'undefined') { throw new Error( - 'Failed to sign API request due to undefined parameter' + 'Failed to sign API request due to undefined parameter', ); } return `${key}=${value}`; @@ -55,7 +55,7 @@ export function serializeParams( export function getRestBaseUrl( useTestnet: boolean, - restInverseOptions: RestClientOptions + restInverseOptions: RestClientOptions, ): string { const exchangeBaseUrls = { livenet: 'https://api.bitget.com', diff --git a/src/util/type-guards.ts b/src/util/type-guards.ts index 2577367..b74709a 100644 --- a/src/util/type-guards.ts +++ b/src/util/type-guards.ts @@ -36,7 +36,7 @@ function isWsChannelEvent(event: WsBaseEvent): event is WsSnapshotChannelEvent { /** TypeGuard: event is an account update (balance) */ export function isWsAccountSnapshotEvent( - event: unknown + event: unknown, ): event is WsSnapshotAccountEvent { return ( isWsSnapshotEvent(event) && @@ -48,7 +48,7 @@ export function isWsAccountSnapshotEvent( /** TypeGuard: event is a positions update */ export function isWsPositionsSnapshotEvent( - event: unknown + event: unknown, ): event is WsSnapshotPositionsEvent { return ( isWsSnapshotEvent(event) && @@ -60,14 +60,14 @@ export function isWsPositionsSnapshotEvent( /** TypeGuard: event is a UMCBL account update (balance) */ export function isWsFuturesAccountSnapshotEvent( - event: unknown + event: unknown, ): event is WsAccountSnapshotUMCBL { return isWsAccountSnapshotEvent(event) && event.arg.instType === 'umcbl'; } /** TypeGuard: event is a UMCBL positions update */ export function isWsFuturesPositionsSnapshotEvent( - event: unknown + event: unknown, ): event is WSPositionSnapshotUMCBL { return isWsPositionsSnapshotEvent(event) && event.arg.instType === 'umcbl'; } diff --git a/src/util/websocket-util.ts b/src/util/websocket-util.ts index 844c873..6b9645b 100644 --- a/src/util/websocket-util.ts +++ b/src/util/websocket-util.ts @@ -11,7 +11,7 @@ import { BitgetInstType, WsTopicSubscribeEventArgs } from './WsStore'; */ type NetworkMap< TRequiredKeys extends string, - TOptionalKeys extends string | undefined = undefined + TOptionalKeys extends string | undefined = undefined, > = Record & (TOptionalKeys extends string ? Record @@ -55,14 +55,14 @@ export const PUBLIC_WS_KEYS = [] as WsKey[]; export const PRIVATE_TOPICS = ['account', 'orders', 'positions', 'ordersAlgo']; export function isPrivateChannel( - channel: TChannel + channel: TChannel, ): boolean { return PRIVATE_TOPICS.includes(channel); } export function getWsKeyForTopic( subscribeEvent: WsTopicSubscribeEventArgs, - isPrivate?: boolean + isPrivate?: boolean, ): WsKey { const instType = subscribeEvent.instType.toUpperCase() as BitgetInstType; switch (instType) { @@ -78,7 +78,7 @@ export function getWsKeyForTopic( default: { throw neverGuard( instType, - `getWsKeyForTopic(): Unhandled market ${'instrumentId'}` + `getWsKeyForTopic(): Unhandled market ${'instrumentId'}`, ); } } @@ -110,14 +110,14 @@ export async function getWsAuthSignature( apiKey: string | undefined, apiSecret: string | undefined, apiPass: string | undefined, - recvWindow: number = 0 + recvWindow: number = 0, ): Promise<{ expiresAt: number; signature: string; }> { if (!apiKey || !apiSecret || !apiPass) { throw new Error( - `Cannot auth - missing api key, secret or passcode in config` + `Cannot auth - missing api key, secret or passcode in config`, ); } const signatureExpiresAt = ((Date.now() + recvWindow) / 1000).toFixed(0); @@ -125,7 +125,7 @@ export async function getWsAuthSignature( const signature = await signMessage( signatureExpiresAt + 'GET' + '/user/verify', apiSecret, - 'base64' + 'base64', ); return { diff --git a/test/broker/private.read.test.ts b/test/broker/private.read.test.ts index 67522a9..cb92c57 100644 --- a/test/broker/private.read.test.ts +++ b/test/broker/private.read.test.ts @@ -27,7 +27,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getBrokerInfo()', async () => { try { expect(await api.getBrokerInfo()).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ @@ -39,7 +39,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getSubAccounts()', async () => { try { expect(await api.getSubAccounts()).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ @@ -51,7 +51,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getSubEmail()', async () => { try { expect(await api.getSubEmail(subUid)).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ @@ -63,7 +63,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getSubSpotAssets()', async () => { try { expect(await api.getSubSpotAssets(subUid)).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { // expect(e.body).toBeNull(); @@ -76,7 +76,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getSubFutureAssets()', async () => { try { expect(await api.getSubFutureAssets(subUid, 'usdt')).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ @@ -88,7 +88,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getSubDepositAddress()', async () => { try { expect(await api.getSubDepositAddress(subUid, coin)).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ @@ -100,7 +100,7 @@ describe('Private Broker REST API GET Endpoints', () => { it('getSubAPIKeys()', async () => { try { expect(await api.getSubAPIKeys(subUid)).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ diff --git a/test/broker/private.write.test.ts b/test/broker/private.write.test.ts index a7e15ff..c9dd3ef 100644 --- a/test/broker/private.write.test.ts +++ b/test/broker/private.write.test.ts @@ -27,7 +27,7 @@ describe('Private Broker REST API POST Endpoints', () => { it('createSubAccount()', async () => { try { expect(await api.createSubAccount('test1')).toMatchObject( - sucessEmptyResponseObject() + sucessEmptyResponseObject(), ); } catch (e) { expect(e.body).toMatchObject({ @@ -39,7 +39,7 @@ describe('Private Broker REST API POST Endpoints', () => { it('modifySubAccount()', async () => { try { expect( - await api.modifySubAccount('test1', 'spot_trade,transfer', 'normal') + await api.modifySubAccount('test1', 'spot_trade,transfer', 'normal'), ).toMatchObject(sucessEmptyResponseObject()); } catch (e) { expect(e.body).toMatchObject({ @@ -51,7 +51,7 @@ describe('Private Broker REST API POST Endpoints', () => { it('modifySubEmail()', async () => { try { expect( - await api.modifySubEmail('test1', 'ASDFASDF@LKMASDF.COM') + await api.modifySubEmail('test1', 'ASDFASDF@LKMASDF.COM'), ).toMatchObject(sucessEmptyResponseObject()); } catch (e) { expect(e.body).toMatchObject({ @@ -69,7 +69,7 @@ describe('Private Broker REST API POST Endpoints', () => { chain: 'TRC20', coin: 'USDT', subUid, - }) + }), ).toMatchObject(sucessEmptyResponseObject()); } catch (e) { expect(e.body).toMatchObject({ @@ -81,7 +81,7 @@ describe('Private Broker REST API POST Endpoints', () => { it('setSubDepositAutoTransfer()', async () => { try { expect( - await api.setSubDepositAutoTransfer(subUid, 'USDT', 'spot') + await api.setSubDepositAutoTransfer(subUid, 'USDT', 'spot'), ).toMatchObject(sucessEmptyResponseObject()); } catch (e) { expect(e.body).toMatchObject({ @@ -97,8 +97,8 @@ describe('Private Broker REST API POST Endpoints', () => { subUid, 'passphrase12345', 'remark', - '10.0.0.1' - ) + '10.0.0.1', + ), ).toMatchObject(sucessEmptyResponseObject()); } catch (e) { expect(e.body).toMatchObject({ @@ -114,7 +114,7 @@ describe('Private Broker REST API POST Endpoints', () => { apikey: '12345', subUid, remark: 'test', - }) + }), ).toMatchObject(sucessEmptyResponseObject()); } catch (e) { expect(e.body).toMatchObject({ diff --git a/test/futures/private.read.test.ts b/test/futures/private.read.test.ts index 4adc392..b117c50 100644 --- a/test/futures/private.read.test.ts +++ b/test/futures/private.read.test.ts @@ -57,7 +57,7 @@ describe('Private Futures REST API GET Endpoints', () => { it('getOpenCount()', async () => { try { expect( - await api.getOpenCount(symbol, marginCoin, 20000, 1) + await api.getOpenCount(symbol, marginCoin, 20000, 1), ).toMatchObject({ ...sucessEmptyResponseObject(), data: { @@ -102,7 +102,7 @@ describe('Private Futures REST API GET Endpoints', () => { endTime: to, marginCoin, symbol, - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: { @@ -125,7 +125,7 @@ describe('Private Futures REST API GET Endpoints', () => { startTime: from, endTime: to, productType: 'umcbl', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: { @@ -180,7 +180,7 @@ describe('Private Futures REST API GET Endpoints', () => { it('getProductTypeOrderHistory()', async () => { try { expect( - await api.getProductTypeOrderHistory('umcbl', from, to, '10') + await api.getProductTypeOrderHistory('umcbl', from, to, '10'), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), @@ -223,7 +223,7 @@ describe('Private Futures REST API GET Endpoints', () => { await api.getProductTypeOrderFills('umcbl', { startTime: from, endTime: to, - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), @@ -253,7 +253,7 @@ describe('Private Futures REST API GET Endpoints', () => { startTime: from, endTime: to, symbol, - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), @@ -267,7 +267,7 @@ describe('Private Futures REST API GET Endpoints', () => { it('getCopyTraderOpenOrder()', async () => { try { expect( - await api.getCopyTraderOpenOrder(symbol, 'umcbl', 1, 0) + await api.getCopyTraderOpenOrder(symbol, 'umcbl', 1, 0), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), @@ -282,7 +282,7 @@ describe('Private Futures REST API GET Endpoints', () => { it('getCopyFollowersOpenOrder()', async () => { try { expect( - await api.getCopyFollowersOpenOrder(symbol, 'umcbl', 1, 0) + await api.getCopyFollowersOpenOrder(symbol, 'umcbl', 1, 0), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), @@ -300,7 +300,7 @@ describe('Private Futures REST API GET Endpoints', () => { { ...sucessEmptyResponseObject(), data: expect.any(Object), - } + }, ); } catch (e) { expect(e.body).toMatchObject({ @@ -342,8 +342,8 @@ describe('Private Futures REST API GET Endpoints', () => { marginCoin, from, 1, - 1 - ) + 1, + ), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), @@ -358,7 +358,7 @@ describe('Private Futures REST API GET Endpoints', () => { it('getCopyTraderHistoricProfitDetail()', async () => { try { expect( - await api.getCopyTraderHistoricProfitDetail(marginCoin, from, 1, 1) + await api.getCopyTraderHistoricProfitDetail(marginCoin, from, 1, 1), ).toMatchObject({ ...sucessEmptyResponseObject(), data: expect.any(Object), diff --git a/test/futures/private.write.test.ts b/test/futures/private.write.test.ts index d4464f4..d7d5492 100644 --- a/test/futures/private.write.test.ts +++ b/test/futures/private.write.test.ts @@ -53,7 +53,7 @@ describe('Private Futures REST API POST Endpoints', () => { it('setMarginMode()', async () => { try { expect( - await api.setMarginMode(symbol, marginCoin, 'crossed') + await api.setMarginMode(symbol, marginCoin, 'crossed'), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -76,7 +76,7 @@ describe('Private Futures REST API POST Endpoints', () => { symbol, size: '1', side: 'open_long', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -100,7 +100,7 @@ describe('Private Futures REST API POST Endpoints', () => { size: '1', side: 'open_long', }, - ]) + ]), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -115,7 +115,7 @@ describe('Private Futures REST API POST Endpoints', () => { it('cancelOrder()', async () => { try { expect( - await api.cancelOrder(symbol, marginCoin, '1234656') + await api.cancelOrder(symbol, marginCoin, '1234656'), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -130,7 +130,7 @@ describe('Private Futures REST API POST Endpoints', () => { it('batchCancelOrder()', async () => { try { expect( - await api.batchCancelOrder(symbol, marginCoin, ['1234656']) + await api.batchCancelOrder(symbol, marginCoin, ['1234656']), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -164,7 +164,7 @@ describe('Private Futures REST API POST Endpoints', () => { symbol, triggerPrice: '1000', triggerType: 'market_price', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -187,7 +187,7 @@ describe('Private Futures REST API POST Endpoints', () => { symbol, triggerPrice: '100', triggerType: 'market_price', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -207,7 +207,7 @@ describe('Private Futures REST API POST Endpoints', () => { marginCoin, symbol, presetTakeProfitPrice: '100', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -229,7 +229,7 @@ describe('Private Futures REST API POST Endpoints', () => { planType: 'profit_plan', holdSide: 'long', triggerPrice: '100', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -251,7 +251,7 @@ describe('Private Futures REST API POST Endpoints', () => { holdSide: 'long', planType: 'profit_plan', triggerPrice: '50', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -270,7 +270,8 @@ describe('Private Futures REST API POST Endpoints', () => { marginCoin, symbol, orderId: '123456', - }) + planType: 'profit_plan', + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -292,7 +293,7 @@ describe('Private Futures REST API POST Endpoints', () => { symbol, orderId: '123456', planType: 'profit_plan', - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, @@ -310,7 +311,7 @@ describe('Private Futures REST API POST Endpoints', () => { { ...sucessEmptyResponseObject(), data: {}, - } + }, ); } catch (e) { expect(e.body).toMatchObject({ @@ -324,7 +325,7 @@ describe('Private Futures REST API POST Endpoints', () => { expect( await api.modifyCopyTraderTPSL(symbol, '123456', { stopLossPrice: 1234, - }) + }), ).toMatchObject({ ...sucessEmptyResponseObject(), data: {}, diff --git a/test/futures/public.test.ts b/test/futures/public.test.ts index 804e2ae..2076fe4 100644 --- a/test/futures/public.test.ts +++ b/test/futures/public.test.ts @@ -70,7 +70,7 @@ describe('Public Spot REST API Endpoints', () => { it('getCandles()', async () => { expect( - await api.getCandles(symbol, '1min', `${from}`, `${to}`) + await api.getCandles(symbol, '1min', `${from}`, `${to}`), ).toMatchObject(expect.any(Array)); }); diff --git a/test/response.util.ts b/test/response.util.ts index 4d704ce..6679da0 100644 --- a/test/response.util.ts +++ b/test/response.util.ts @@ -19,7 +19,7 @@ export function sucessEmptyResponseObject() { export function errorResponseObject( result: null | any = null, ret_code: number, - ret_msg: string + ret_msg: string, ) { return { result, @@ -30,7 +30,7 @@ export function errorResponseObject( export function errorResponseObjectV3( result: null | any = null, - retCode: number + retCode: number, ) { return { result, diff --git a/test/ws.private.test.ts b/test/ws.private.test.ts index 3c735b5..7354069 100644 --- a/test/ws.private.test.ts +++ b/test/ws.private.test.ts @@ -26,7 +26,7 @@ describe('Private Spot Websocket Client', () => { apiSecret: 'bad', apiPass: 'bad', }, - getSilentLogger('expect401') + getSilentLogger('expect401'), ); // const wsOpenPromise = waitForSocketEvent(badClient, 'open'); @@ -62,7 +62,7 @@ describe('Private Spot Websocket Client', () => { beforeAll(() => { wsClient = new WebsocketClient( wsClientOptions, - getSilentLogger('expectSuccess') + getSilentLogger('expectSuccess'), ); wsClient.connectAll(); // logAllEvents(wsClient); diff --git a/test/ws.public.test.ts b/test/ws.public.test.ts index 815f48d..0b6539b 100644 --- a/test/ws.public.test.ts +++ b/test/ws.public.test.ts @@ -13,7 +13,7 @@ describe('Public Spot Websocket Client', () => { beforeAll(() => { wsClient = new WebsocketClient( wsClientOptions, - getSilentLogger('expectSuccess') + getSilentLogger('expectSuccess'), ); wsClient.connectAll(); logAllEvents(wsClient); diff --git a/test/ws.util.ts b/test/ws.util.ts index ad509e7..1a83175 100644 --- a/test/ws.util.ts +++ b/test/ws.util.ts @@ -24,12 +24,12 @@ export const fullLogger = { export function waitForSocketEvent( wsClient: WebsocketClient, event: WsClientEvent, - timeoutMs: number = 4.5 * 1000 + timeoutMs: number = 4.5 * 1000, ) { return new Promise((resolve, reject) => { const timeout = setTimeout(() => { reject( - `Failed to receive "${event}" event before timeout. Check that these are correct: topic, api keys (if private), signature process (if private)` + `Failed to receive "${event}" event before timeout. Check that these are correct: topic, api keys (if private), signature process (if private)`, ); }, timeoutMs);