tests for unified margin WS

This commit is contained in:
tiagosiebler
2022-09-16 19:56:24 +01:00
parent 2766a17fe8
commit 4eca5fb180
5 changed files with 169 additions and 33 deletions

View File

@@ -23,7 +23,6 @@ describe('Public Linear Perps Websocket Client', () => {
afterAll(() => {
wsClient.closeAll();
wsClient.removeAllListeners();
});
it('should open a public ws connection', async () => {
@@ -65,31 +64,4 @@ describe('Public Linear Perps Websocket Client', () => {
console.error(`Wait for "${wsTopic}" event exception: `, e);
}
});
it('should fail to subscribe to private events (no keys)', async () => {
const wsResponsePromise = waitForSocketEvent(wsClient, 'response');
// const wsUpdatePromise = waitForSocketEvent(wsClient, 'update');
const wsTopic = 'wallet';
// No easy way to trigger a private event (other than executing trades)
// expect(wsUpdatePromise).resolves.toMatchObject({
// topic: wsTopic,
// data: expect.any(Array),
// });
wsClient.subscribe(wsTopic);
try {
expect(await wsResponsePromise).toBeFalsy();
} catch (e) {
expect(e).toMatchObject({
request: {
args: [wsTopic],
op: 'subscribe',
},
success: false,
});
}
});
});