aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/mock-servers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-05 15:43:21 +0200
committerChocobozzz <me@florianbigard.com>2022-07-06 15:13:55 +0200
commit630d0a1bf5897fff203cb07e426223f55dcc882d (patch)
tree5e6fa9d26f3f21178a538bd1ac38fa0a3f4f228c /server/tests/shared/mock-servers
parent15b43b214eb37b05aa65aa8ef61fd0e6aa0b62d2 (diff)
downloadPeerTube-630d0a1bf5897fff203cb07e426223f55dcc882d.tar.gz
PeerTube-630d0a1bf5897fff203cb07e426223f55dcc882d.tar.zst
PeerTube-630d0a1bf5897fff203cb07e426223f55dcc882d.zip
Introduce experimental telemetry
Diffstat (limited to 'server/tests/shared/mock-servers')
-rw-r--r--server/tests/shared/mock-servers/index.ts1
-rw-r--r--server/tests/shared/mock-servers/mock-http.ts23
2 files changed, 24 insertions, 0 deletions
diff --git a/server/tests/shared/mock-servers/index.ts b/server/tests/shared/mock-servers/index.ts
index abf4a8203..1fa983116 100644
--- a/server/tests/shared/mock-servers/index.ts
+++ b/server/tests/shared/mock-servers/index.ts
@@ -1,5 +1,6 @@
1export * from './mock-429' 1export * from './mock-429'
2export * from './mock-email' 2export * from './mock-email'
3export * from './mock-http'
3export * from './mock-instances-index' 4export * from './mock-instances-index'
4export * from './mock-joinpeertube-versions' 5export * from './mock-joinpeertube-versions'
5export * from './mock-object-storage' 6export * from './mock-object-storage'
diff --git a/server/tests/shared/mock-servers/mock-http.ts b/server/tests/shared/mock-servers/mock-http.ts
new file mode 100644
index 000000000..b7a019e07
--- /dev/null
+++ b/server/tests/shared/mock-servers/mock-http.ts
@@ -0,0 +1,23 @@
1import express from 'express'
2import { Server } from 'http'
3import { getPort, randomListen, terminateServer } from './shared'
4
5export class MockHTTP {
6 private server: Server
7
8 async initialize () {
9 const app = express()
10
11 app.get('/*', (req: express.Request, res: express.Response, next: express.NextFunction) => {
12 return res.sendStatus(200)
13 })
14
15 this.server = await randomListen(app)
16
17 return getPort(this.server)
18 }
19
20 terminate () {
21 return terminateServer(this.server)
22 }
23}