blob: e741d6735d228951f3d73435c7180619b39a3c5c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { createServer, Server } from 'http'
import { createProxy } from 'proxy'
import { getPort, terminateServer } from './shared'
class MockProxy {
private server: Server
initialize () {
return new Promise<number>(res => {
this.server = createProxy(createServer())
this.server.listen(0, () => res(getPort(this.server)))
})
}
terminate () {
return terminateServer(this.server)
}
}
// ---------------------------------------------------------------------------
export {
MockProxy
}
|