]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/single-server.ts
Add trending sort tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / single-server.ts
index a757ad9da809fb19b913072b05e5941b0c9633d3..e3d62b7a0df4c1dfa41ccf40f47557c514624256 100644 (file)
@@ -196,7 +196,7 @@ describe('Test a single server', function () {
   })
 
   it('Should have the views updated', async function () {
-    this.timeout(10000)
+    this.timeout(20000)
 
     await viewVideo(server.url, videoId)
     await viewVideo(server.url, videoId)
@@ -212,6 +212,9 @@ describe('Test a single server', function () {
     await viewVideo(server.url, videoId)
     await viewVideo(server.url, videoId)
 
+    // Wait the repeatable job
+    await wait(8000)
+
     const res = await getVideo(server.url, videoId)
 
     const video = res.body
@@ -336,6 +339,14 @@ describe('Test a single server', function () {
     videoId = videos[3].uuid
   })
 
+  it('Should list and sort by trending in descending order', async function () {
+    const res = await getVideosListPagination(server.url, 0, 2, '-trending')
+
+    const videos = res.body.data
+    expect(res.body.total).to.equal(6)
+    expect(videos.length).to.equal(2)
+  })
+
   it('Should update a video', async function () {
     const attributes = {
       name: 'my super video updated',