test/specs/no-native-throws.ts   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 0

Size

Lines of Code 18
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 15
mnd 4
bc 4
fnc 0
dl 0
loc 18
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import mockServer from '../mock/server'
2
import { test } from '../suite'
3
import WebSocketClient from '../../src/WSC'
4
5
/** Ready method. */
6
test('No native throws without an adapter', async () => {
7
  const {port} = await mockServer()
8
  let pass = false
9
  try {
10
    new WebSocketClient({ url: 'ws://127.0.0.1:' + port })
11
    try {
12
      if(WebSocket) pass = true
13
    } catch {}
14
  } catch {
15
    pass=true
16
  }
17
  if(!pass) throw new Error('Does not throw.')
18
})