]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/no-client.ts
emit more specific status codes on video upload (#3423)
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / no-client.ts
index 88d34063cbf51268c0832e0a10ee6fee2b37f160..d589f51f3e6ef1b6ccd4013fb32f3cf4666bb724 100644 (file)
@@ -1,11 +1,8 @@
 import 'mocha'
 import * as request from 'supertest'
-import {
-  flushTests,
-  killallServers,
-  ServerInfo
-} from '../../../../shared/extra-utils'
-import { runServer } from '../../../../shared/extra-utils/server/servers'
+import { ServerInfo } from '../../../../shared/extra-utils'
+import { cleanupTests, flushAndRunServer } from '../../../../shared/extra-utils/server/servers'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 describe('Start and stop server without web client routes', function () {
   let server: ServerInfo
@@ -13,24 +10,17 @@ describe('Start and stop server without web client routes', function () {
   before(async function () {
     this.timeout(30000)
 
-    await flushTests()
-
-    server = await runServer(1, {}, ['--no-client'])
+    server = await flushAndRunServer(1, {}, [ '--no-client' ])
   })
 
   it('Should fail getting the client', function () {
     const req = request(server.url)
       .get('/')
 
-    return req.expect(404)
+    return req.expect(HttpStatusCode.NOT_FOUND_404)
   })
 
   after(async function () {
-    killallServers([ server ])
-
-    // Keep the logs if the test failed
-    if (this['ok']) {
-      await flushTests()
-    }
+    await cleanupTests([ server ])
   })
 })