aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/mock-servers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-09-06 08:13:11 +0200
committerChocobozzz <me@florianbigard.com>2021-09-06 08:13:11 +0200
commit70430c2796b6c0455a863edc62760a3d45951fc5 (patch)
tree7620d5a8db0c9b6cbf5a11d1c794875402828789 /shared/extra-utils/mock-servers/utils.ts
parent6d210220be0875d63461829d83c6e3a59d05cf7a (diff)
downloadPeerTube-70430c2796b6c0455a863edc62760a3d45951fc5.tar.gz
PeerTube-70430c2796b6c0455a863edc62760a3d45951fc5.tar.zst
PeerTube-70430c2796b6c0455a863edc62760a3d45951fc5.zip
Wait mock server termination
Diffstat (limited to 'shared/extra-utils/mock-servers/utils.ts')
-rw-r--r--shared/extra-utils/mock-servers/utils.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/shared/extra-utils/mock-servers/utils.ts b/shared/extra-utils/mock-servers/utils.ts
new file mode 100644
index 000000000..64d94c868
--- /dev/null
+++ b/shared/extra-utils/mock-servers/utils.ts
@@ -0,0 +1,17 @@
1import { Server } from 'http'
2
3function terminateServer (server: Server) {
4 if (!server) return Promise.resolve()
5
6 return new Promise<void>((res, rej) => {
7 server.close(err => {
8 if (err) return rej(err)
9
10 return res()
11 })
12 })
13}
14
15export {
16 terminateServer
17}