UNPKG

663 BJavaScriptView Raw
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
5describe('ws/polyfill', () => {
6 let origWs;
7
8 beforeEach(() => {
9 origWs = global.WebSocket;
10 global.WebSocket = null;
11 });
12
13 afterEach(() => {
14 global.WebSocket = origWs;
15 });
16
17 it('polyfills with no exceptions (without WebSocket)', () => {
18 expect(require('./polyfill')).toBeDefined();
19 });
20
21 it('polyfills with no exceptions (with WebSocket)', () => {
22 global.WebSocket = () => true;
23
24 expect(require('./polyfill')).toBeDefined();
25 });
26});