aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/extra-utils/mock-servers/utils.ts
blob: 64d94c8688a14642575ae68fa8075947cb1e7d9b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                           
import { Server } from 'http'

function terminateServer (server: Server) {
  if (!server) return Promise.resolve()

  return new Promise<void>((res, rej) => {
    server.close(err => {
      if (err) return rej(err)

      return res()
    })
  })
}

export {
  terminateServer
}