]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/follows.ts
add cli option to run without client
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / follows.ts
index 25c87b4dca380a4614c5f5518a4ffc46c2da1e1c..e80e93e7f5b33e8a5ced35831f1d977334b0bc42 100644 (file)
@@ -27,7 +27,7 @@ import {
 import { rateVideo } from '../../utils/videos/videos'
 import { waitJobs } from '../../utils/server/jobs'
 import { createVideoCaption, listVideoCaptions, testCaptionFile } from '../../utils/videos/video-captions'
-import { VideoCaption } from '../../../../shared/models/videos/video-caption.model'
+import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model'
 
 const expect = chai.expect
 
@@ -66,7 +66,7 @@ describe('Test follows', function () {
   })
 
   it('Should have server 1 following server 2 and 3', async function () {
-    this.timeout(10000)
+    this.timeout(30000)
 
     await follow(servers[0].url, [ servers[1].url, servers[2].url ], servers[0].accessToken)
 
@@ -93,7 +93,26 @@ describe('Test follows', function () {
     expect(server3Follow.state).to.equal('accepted')
   })
 
-  it('Should have 0 followings on server 1 and 2', async function () {
+  it('Should search followings on server 1', async function () {
+    {
+      const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 1, 'createdAt', ':9002')
+      const follows = res.body.data
+
+      expect(res.body.total).to.equal(1)
+      expect(follows.length).to.equal(1)
+      expect(follows[ 0 ].following.host).to.equal('localhost:9002')
+    }
+
+    {
+      const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 1, 'createdAt', 'bla')
+      const follows = res.body.data
+
+      expect(res.body.total).to.equal(0)
+      expect(follows.length).to.equal(0)
+    }
+  })
+
+  it('Should have 0 followings on server 2 and 3', async function () {
     for (const server of [ servers[1], servers[2] ]) {
       const res = await getFollowingListPaginationAndSort(server.url, 0, 5, 'createdAt')
       const follows = res.body.data
@@ -116,6 +135,25 @@ describe('Test follows', function () {
     }
   })
 
+  it('Should search followers on server 2', async function () {
+    {
+      const res = await getFollowersListPaginationAndSort(servers[ 2 ].url, 0, 5, 'createdAt', '9001')
+      const follows = res.body.data
+
+      expect(res.body.total).to.equal(1)
+      expect(follows.length).to.equal(1)
+      expect(follows[ 0 ].following.host).to.equal('localhost:9003')
+    }
+
+    {
+      const res = await getFollowersListPaginationAndSort(servers[ 2 ].url, 0, 5, 'createdAt', 'bla')
+      const follows = res.body.data
+
+      expect(res.body.total).to.equal(0)
+      expect(follows.length).to.equal(0)
+    }
+  })
+
   it('Should have 0 followers on server 1', async function () {
     const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 5, 'createdAt')
     const follows = res.body.data
@@ -311,7 +349,8 @@ describe('Test follows', function () {
         likes: 1,
         dislikes: 1,
         channel: {
-          name: 'Default root channel',
+          displayName: 'Main root channel',
+          name: 'root_channel',
           description: '',
           isLocal
         },