aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/server/index.ts1
-rw-r--r--server/tests/api/server/no-client.ts36
-rw-r--r--server/tests/utils/server/servers.ts4
3 files changed, 39 insertions, 2 deletions
diff --git a/server/tests/api/server/index.ts b/server/tests/api/server/index.ts
index eeb8b7a28..78ab7e18b 100644
--- a/server/tests/api/server/index.ts
+++ b/server/tests/api/server/index.ts
@@ -6,3 +6,4 @@ import './jobs'
6import './reverse-proxy' 6import './reverse-proxy'
7import './stats' 7import './stats'
8import './tracker' 8import './tracker'
9import './no-client'
diff --git a/server/tests/api/server/no-client.ts b/server/tests/api/server/no-client.ts
new file mode 100644
index 000000000..6d6ce8532
--- /dev/null
+++ b/server/tests/api/server/no-client.ts
@@ -0,0 +1,36 @@
1import 'mocha'
2import * as request from 'supertest'
3import {
4 flushTests,
5 killallServers,
6 ServerInfo
7} from '../../utils/index'
8import { runServer } from '../../utils/server/servers'
9
10describe('Start and stop server without web client routes', function () {
11 let server: ServerInfo
12
13 before(async function () {
14 this.timeout(30000)
15
16 await flushTests()
17
18 server = await runServer(1, {}, ['--no-client'])
19 })
20
21 it('Should fail getting the client', function () {
22 const req = request(server.url)
23 .get('/')
24
25 return req.expect(404)
26 })
27
28 after(async function () {
29 killallServers([ server ])
30
31 // Keep the logs if the test failed
32 if (this['ok']) {
33 await flushTests()
34 }
35 })
36})
diff --git a/server/tests/utils/server/servers.ts b/server/tests/utils/server/servers.ts
index 3c946db27..f358a21f1 100644
--- a/server/tests/utils/server/servers.ts
+++ b/server/tests/utils/server/servers.ts
@@ -69,7 +69,7 @@ function flushTests () {
69 }) 69 })
70} 70}
71 71
72function runServer (serverNumber: number, configOverride?: Object) { 72function runServer (serverNumber: number, configOverride?: Object, args = []) {
73 const server: ServerInfo = { 73 const server: ServerInfo = {
74 app: null, 74 app: null,
75 serverNumber: serverNumber, 75 serverNumber: serverNumber,
@@ -115,7 +115,7 @@ function runServer (serverNumber: number, configOverride?: Object) {
115 } 115 }
116 116
117 return new Promise<ServerInfo>(res => { 117 return new Promise<ServerInfo>(res => {
118 server.app = fork(join(__dirname, '..', '..', '..', '..', 'dist', 'server.js'), [], options) 118 server.app = fork(join(__dirname, '..', '..', '..', '..', 'dist', 'server.js'), args, options)
119 server.app.stdout.on('data', function onStdout (data) { 119 server.app.stdout.on('data', function onStdout (data) {
120 let dontContinue = false 120 let dontContinue = false
121 121