1 | // Copyright 2017-2018 @polkadot/api-provider authors & contributors
|
2 | // This software may be modified and distributed under the terms
|
3 | // of the ISC license. See the LICENSE file for details.
|
4 |
|
5 | import { mockWs, TEST_WS_URL } from '../../test/mockWs';
|
6 |
|
7 | import Ws from './index';
|
8 |
|
9 | let ws;
|
10 | let mock;
|
11 |
|
12 | function createWs (requests, autoConnect) {
|
13 | mock = mockWs(requests);
|
14 | ws = new Ws(TEST_WS_URL, autoConnect);
|
15 |
|
16 | return ws;
|
17 | }
|
18 |
|
19 | describe('Ws', () => {
|
20 | afterEach(() => {
|
21 | if (mock) {
|
22 | mock.done();
|
23 | mock = null;
|
24 | }
|
25 | });
|
26 |
|
27 | it('returns the connected state', () => {
|
28 | expect(
|
29 | createWs([]).isConnected()
|
30 | ).toEqual(false);
|
31 | });
|
32 | });
|