]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/pods.ts
Add pod list endpoint with pagination, sort...
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / pods.ts
index a897e4dcd959801e509b36442a2f7604460417ba..9f9c2e4f0eca1da10f1d06a09e10e41c1c41f6f5 100644 (file)
@@ -15,7 +15,6 @@ import {
 } from '../../utils'
 
 describe('Test pods API validators', function () {
-  const path = '/api/v1/pods/'
   let server: ServerInfo
 
   // ---------------------------------------------------------------
@@ -30,6 +29,7 @@ describe('Test pods API validators', function () {
   })
 
   describe('When managing friends', function () {
+    const path = '/api/v1/pods/'
     let userAccessToken = null
 
     before(async function () {
@@ -110,6 +110,32 @@ describe('Test pods API validators', function () {
       })
     })
 
+    describe('When listing friends', function () {
+      it('Should fail with a bad start pagination', async function () {
+        await request(server.url)
+          .get(path)
+          .query({ start: 'hello' })
+          .set('Accept', 'application/json')
+          .expect(400)
+      })
+
+      it('Should fail with a bad count pagination', async function () {
+        await request(server.url)
+          .get(path)
+          .query({ count: 'hello' })
+          .set('Accept', 'application/json')
+          .expect(400)
+      })
+
+      it('Should fail with an incorrect sort', async function () {
+        await request(server.url)
+          .get(path)
+          .query({ sort: 'hello' })
+          .set('Accept', 'application/json')
+          .expect(400)
+      })
+    })
+
     describe('When quitting friends', function () {
       it('Should fail with an invalid token', async function () {
         await request(server.url)
@@ -175,7 +201,9 @@ describe('Test pods API validators', function () {
     })
   })
 
-  describe('When adding a pod', function () {
+  describe('When adding a pod from remote', function () {
+    const path = '/api/v1/remote/pods/add'
+
     it('Should fail with nothing', async function () {
       const fields = {}
       await makePostBodyRequest({ url: server.url, path, fields })