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

@@ -46,15 +46,20 @@ describe('Private Spot V1 Websocket Client', () => {
wsClient.connectPrivate();
expect(wsOpenPromise).resolves.toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.spotPrivate,
});
try {
expect(await wsOpenPromise).toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
// wsKey: WS_KEY_MAP.spotPrivate,
// also opens public conn automatically, which can confuse the test
});
} catch (e) {
expect(e).toBeFalsy();
}
// expect(wsUpdatePromise).resolves.toMatchObject({
// topic: 'wsTopic',
// data: expect.any(Array),
// });
await Promise.all([wsOpenPromise]);
// await Promise.all([wsUpdatePromise]);
// await promiseSleep(4000);
});

View File

@@ -79,13 +79,11 @@ describe('Private Spot V3 Websocket Client', () => {
const wsOpenPromise = waitForSocketEvent(wsClient, 'open');
const wsResponsePromise = waitForSocketEvent(wsClient, 'response');
expect(wsOpenPromise).resolves.toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.spotV3Private,
});
try {
await Promise.all([wsOpenPromise]);
expect(await wsOpenPromise).toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.spotV3Private,
});
} catch (e) {
expect(e).toBeFalsy();
}

View File

@@ -34,12 +34,14 @@ describe('Public Spot V1 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.spotPublic,
});
await Promise.all([wsOpenPromise]);
try {
expect(await wsOpenPromise).toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.spotPublic,
});
} catch (e) {
expect(e).toBeFalsy();
}
});
it('should subscribe to public orderbook events', async () => {

View File

@@ -34,12 +34,14 @@ describe('Public Spot V3 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.spotV3Public,
});
await Promise.all([wsOpenPromise]);
try {
expect(await wsOpenPromise).toMatchObject({
event: WS_OPEN_EVENT_PARTIAL,
wsKey: WS_KEY_MAP.spotV3Public,
});
} catch (e) {
expect(e).toBeFalsy();
}
});
it('should subscribe to public orderbook events', async () => {