From 9c68bec0e36571f7846fe9c3d8ac20dd4c01e173 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Thu, 25 Jul 2024 16:04:02 +0100 Subject: [PATCH] chore(): deprecate unified margin private test --- test/unified-margin/ws.private.test.ts | 84 -------------------------- 1 file changed, 84 deletions(-) delete mode 100644 test/unified-margin/ws.private.test.ts diff --git a/test/unified-margin/ws.private.test.ts b/test/unified-margin/ws.private.test.ts deleted file mode 100644 index fbe6760..0000000 --- a/test/unified-margin/ws.private.test.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* eslint-disable no-unused-vars */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { - WSClientConfigurableOptions, - WS_KEY_MAP, - WebsocketClient, -} from '../../src'; -import { - WS_OPEN_EVENT_PARTIAL, - fullLogger, - getSilentLogger, - logAllEvents, - waitForSocketEvent, -} from '../ws.util'; - -describe('Private Unified Margin Websocket Client', () => { - const API_KEY = process.env.API_KEY_COM; - const API_SECRET = process.env.API_SECRET_COM; - - let wsClient: WebsocketClient; - - const wsClientOptions: WSClientConfigurableOptions = { - market: 'unifiedPerp', - key: API_KEY, - secret: API_SECRET, - }; - - beforeAll(() => { - wsClient = new WebsocketClient( - wsClientOptions, - getSilentLogger('expectSuccessNoAuth') - // fullLogger - ); - // logAllEvents(wsClient); - wsClient.connectPrivate(); - }); - - afterAll(() => { - wsClient.closeAll(true); - }); - - it('should open a public ws connection', async () => { - const wsOpenPromise = waitForSocketEvent(wsClient, 'open'); - try { - expect(await wsOpenPromise).toMatchObject({ - event: WS_OPEN_EVENT_PARTIAL, - wsKey: WS_KEY_MAP.unifiedPrivate, - }); - } catch (e) { - expect(e).toBeFalsy(); - } - }); - - // Should work, but don't have unified margin activated - needs extra testing - // {"conn_id": "064443fffef10442-0000798d-0000a9f6-ba32aeee49712540-1752c4f4", "ret_msg": "3303001", "success": false, "type": "COMMAND_RESP", "wsKey": "unifiedPrivate"} - - it.skip('should subscribe to public private unified account events', async () => { - const wsResponsePromise = waitForSocketEvent(wsClient, 'response'); - const wsUpdatePromise = waitForSocketEvent(wsClient, 'update'); - - // USDT should be detected and automatically routed through the USDT connection - const topic = 'user.position.unifiedAccount'; - wsClient.subscribe(topic); - - try { - expect(await wsResponsePromise).toMatchObject({ - op: 'subscribe', - req_id: topic, - success: true, - wsKey: WS_KEY_MAP.unifiedPrivate, - }); - } catch (e) { - // sub failed - expect(e).toBeFalsy(); - } - - try { - expect(await wsUpdatePromise).toStrictEqual(''); - } catch (e) { - // no data - expect(e).toBeFalsy(); - } - }); -});