]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/single-server.ts
Playlist server API
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / single-server.ts
index 89408fec6580b4236abaa820e0ba4fcc45cecc12..cfdcbaf3f1ac8cc8ae6fb7bd214728b9958e8fdf 100644 (file)
@@ -28,7 +28,7 @@ import {
   uploadVideo,
   viewVideo,
   wait
-} from '../../utils'
+} from '../../../../shared/utils'
 
 const expect = chai.expect
 
@@ -55,6 +55,7 @@ describe('Test a single server', function () {
     tags: [ 'tag1', 'tag2', 'tag3' ],
     privacy: VideoPrivacy.PUBLIC,
     commentsEnabled: true,
+    downloadEnabled: true,
     channel: {
       displayName: 'Main root channel',
       name: 'root_channel',
@@ -87,6 +88,7 @@ describe('Test a single server', function () {
     privacy: VideoPrivacy.PUBLIC,
     duration: 5,
     commentsEnabled: false,
+    downloadEnabled: false,
     channel: {
       name: 'root_channel',
       displayName: 'Main root channel',
@@ -118,7 +120,7 @@ describe('Test a single server', function () {
     const categories = res.body
     expect(Object.keys(categories)).to.have.length.above(10)
 
-    expect(categories[11]).to.equal('News')
+    expect(categories[11]).to.equal('News & Politics')
   })
 
   it('Should list video licences', async function () {
@@ -339,6 +341,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',
@@ -348,6 +358,7 @@ describe('Test a single server', function () {
       nsfw: false,
       description: 'my super description updated',
       commentsEnabled: false,
+      downloadEnabled: false,
       tags: [ 'tagup1', 'tagup2' ]
     }
     await updateVideo(server.url, server.accessToken, videoId, attributes)