]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/video-abuses.ts
Add search target check params
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / video-abuses.ts
index e2813d470cf5c8ef6b0a48e55b3e9d224331de62..e643cb95e529acf6f25cb5d47ef728dd40ae94c3 100644 (file)
@@ -1,15 +1,14 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
 import {
+  cleanupTests,
   createUser,
   deleteVideoAbuse,
-  flushTests,
-  killallServers,
+  flushAndRunServer,
   makeGetRequest,
   makePostBodyRequest,
-  flushAndRunServer,
   ServerInfo,
   setAccessTokensToServers,
   updateVideoAbuse,
@@ -77,6 +76,22 @@ describe('Test video abuses API validators', function () {
         statusCodeExpected: 403
       })
     })
+
+    it('Should fail with a bad id filter', async function () {
+      await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { id: 'toto' } })
+    })
+
+    it('Should fail with a bad state filter', async function () {
+      await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { state: 'toto' } })
+    })
+
+    it('Should fail with a bad videoIs filter', async function () {
+      await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { videoIs: 'toto' } })
+    })
+
+    it('Should succeed with the correct params', async function () {
+      await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { id: 13 }, statusCodeExpected: 200 })
+    })
   })
 
   describe('When reporting a video abuse', function () {
@@ -127,6 +142,7 @@ describe('Test video abuses API validators', function () {
 
   describe('When updating a video abuse', function () {
     const basePath = '/api/v1/videos/'
+    // eslint-disable-next-line @typescript-eslint/no-unused-vars
     let path: string
 
     before(() => {
@@ -164,6 +180,7 @@ describe('Test video abuses API validators', function () {
 
   describe('When deleting a video abuse', function () {
     const basePath = '/api/v1/videos/'
+    // eslint-disable-next-line @typescript-eslint/no-unused-vars
     let path: string
 
     before(() => {
@@ -188,7 +205,7 @@ describe('Test video abuses API validators', function () {
     })
   })
 
-  after(function () {
-    killallServers([ server ])
+  after(async function () {
+    await cleanupTests([ server ])
   })
 })