Total Complexity | 2 |
Complexity/F | 0 |
Lines of Code | 18 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { test } from '../suite' |
||
2 | import { createNew } from '../utils.js' |
||
3 | import mockServer from '../mock/server' |
||
4 | |||
5 | /** Closes the connenction. */ |
||
6 | test('close', () => new Promise<void>(async (ff, rj) => { |
||
7 | const {port} = await mockServer() |
||
8 | const ws = await createNew({}, port) |
||
9 | |||
10 | setTimeout(async () => { |
||
11 | try { |
||
12 | await ws.close() |
||
13 | if(ws.socket === null) ff(); else rj() |
||
14 | } catch(e) { |
||
15 | rj() |
||
16 | } |
||
17 | }, 500) |
||
18 | })) |