]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/mock-servers/mock-proxy.ts
Add peertube short link import test
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / mock-servers / mock-proxy.ts
index 5365f87d12b3d9b3cd8916b48d4ca62ab9bd0bf6..8583250f391860d92fde61c7f87e68a173b78f66 100644 (file)
@@ -1,14 +1,15 @@
 
 import { createServer, Server } from 'http'
-import * as proxy from 'proxy'
+import proxy from 'proxy'
 import { randomInt } from '@shared/core-utils'
+import { terminateServer } from './utils'
 
 class MockProxy {
   private server: Server
 
   initialize () {
     return new Promise<number>(res => {
-      const port = 42501 + randomInt(1, 100)
+      const port = 46000 + randomInt(1, 1000)
 
       this.server = proxy(createServer())
       this.server.listen(port, () => res(port))
@@ -16,7 +17,7 @@ class MockProxy {
   }
 
   terminate () {
-    if (this.server) this.server.close()
+    return terminateServer(this.server)
   }
 }