#218 Returning a promise when subscribing to topics
This commit is contained in:
27
test/v5/public.ws.test.ts
Normal file
27
test/v5/public.ws.test.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { WebsocketClient } from '../../src';
|
||||
|
||||
describe('Public V5 Websocket client', () => {
|
||||
const api = new WebsocketClient({
|
||||
market: 'v5',
|
||||
});
|
||||
|
||||
const linearSymbol = 'BTCUSDT';
|
||||
const linearCategory = 'linear';
|
||||
|
||||
describe('Topics subscription confirmation', () => {
|
||||
it('can subscribeV5 to LINEAR with valid topic', async () => {
|
||||
await expect(
|
||||
api.subscribeV5(`publicTrade.${linearSymbol}`, linearCategory),
|
||||
).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('cannot subscribeV5 to LINEAR with valid topic', async () => {
|
||||
try {
|
||||
await api.subscribeV5(`publicTrade.${linearSymbol}X`, linearCategory);
|
||||
} catch (e) {
|
||||
expect(e).toBeDefined();
|
||||
expect(e).toMatch('(publicTrade.BTCUSDTX) failed to subscribe');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user