]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/jobs.ts
Fix live tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / jobs.ts
index c7013951424d69a43012600acdfb63e9c41a7740..3c1d2049bbbcb7e00dd101a286e1956f20e94be9 100644 (file)
@@ -1,16 +1,14 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
 import {
+  cleanupTests,
   createUser,
-  flushTests,
-  killallServers,
   flushAndRunServer,
   ServerInfo,
   setAccessTokensToServers,
-  userLogin,
-  cleanupTests
+  userLogin
 } from '../../../../shared/extra-utils'
 import {
   checkBadCountPagination,
@@ -18,6 +16,7 @@ import {
   checkBadStartPagination
 } from '../../../../shared/extra-utils/requests/check-api-params'
 import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 describe('Test jobs API validators', function () {
   const path = '/api/v1/jobs/failed'
@@ -51,6 +50,17 @@ describe('Test jobs API validators', function () {
       })
     })
 
+    it('Should fail with an incorrect job type', async function () {
+      await makeGetRequest({
+        url: server.url,
+        token: server.accessToken,
+        path,
+        query: {
+          jobType: 'toto'
+        }
+      })
+    })
+
     it('Should fail with a bad start pagination', async function () {
       await checkBadStartPagination(server.url, path, server.accessToken)
     })
@@ -67,7 +77,7 @@ describe('Test jobs API validators', function () {
       await makeGetRequest({
         url: server.url,
         path,
-        statusCodeExpected: 401
+        statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
       })
     })
 
@@ -76,9 +86,10 @@ describe('Test jobs API validators', function () {
         url: server.url,
         path,
         token: userAccessToken,
-        statusCodeExpected: 403
+        statusCodeExpected: HttpStatusCode.FORBIDDEN_403
       })
     })
+
   })
 
   after(async function () {