cleaning for ws tests

This commit is contained in:
tiagosiebler
2022-09-16 15:09:39 +01:00
parent f4a569dcba
commit 1c3707b6d2
12 changed files with 90 additions and 93 deletions

View File

@@ -77,7 +77,6 @@ describe('Private USDC Option Websocket Client', () => {
wsClientOptions,
getSilentLogger('expectSuccess')
);
wsClient.connectPrivate();
// logAllEvents(wsClient);
});
@@ -86,16 +85,15 @@ describe('Private USDC Option Websocket Client', () => {
});
it('should open a private ws connection', async () => {
wsClient.connectPrivate();
const wsOpenPromise = waitForSocketEvent(wsClient, 'open');
const wsResponsePromise = waitForSocketEvent(wsClient, 'response');
expect(wsOpenPromise).resolves.toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.usdcOptionPrivate,
});
try {
await Promise.all([wsOpenPromise]);
expect(await wsOpenPromise).toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.usdcOptionPrivate,
});
} catch (e) {
expect(e).toBeFalsy();
}
@@ -113,6 +111,7 @@ describe('Private USDC Option Websocket Client', () => {
});
it(`should subscribe to private "${wsTopic}" events`, async () => {
wsClient.connectPrivate();
const wsResponsePromise = waitForSocketEvent(wsClient, 'response');
const wsUpdatePromise = waitForSocketEvent(wsClient, 'update');

View File

@@ -31,13 +31,14 @@ describe('Public USDC Option Websocket Client', () => {
it('should open a public ws connection', async () => {
const wsOpenPromise = waitForSocketEvent(wsClient, 'open');
expect(wsOpenPromise).resolves.toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.usdcOptionPublic,
});
await Promise.all([wsOpenPromise]);
try {
expect(await wsOpenPromise).toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.usdcOptionPublic,
});
} catch (e) {
expect(e).toBeFalsy();
}
});
it('should subscribe to public trade events', async () => {