]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/videos.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / videos.ts
index 51e592a15ca29967c2df0578cce69149a230ae1f..0d4665954cdc35ed3c27decffac7a89a2e99a5d8 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import * as chai from 'chai'
 import { omit } from 'lodash'
@@ -56,13 +56,13 @@ describe('Test videos API validator', function () {
 
     {
       const res = await getMyUserInformation(server.url, server.accessToken)
-      channelId = res.body.videoChannels[ 0 ].id
-      channelName = res.body.videoChannels[ 0 ].name
+      channelId = res.body.videoChannels[0].id
+      channelName = res.body.videoChannels[0].name
       accountName = res.body.account.name + '@' + res.body.account.host
     }
   })
 
-  describe('When listing a video', function () {
+  describe('When listing videos', function () {
     it('Should fail with a bad start pagination', async function () {
       await checkBadStartPagination(server.url, path)
     })
@@ -75,8 +75,12 @@ describe('Test videos API validator', function () {
       await checkBadSortPagination(server.url, path)
     })
 
+    it('Should fail with a bad skipVideos query', async function () {
+      await makeGetRequest({ url: server.url, path, statusCodeExpected: 200, query: { skipCount: 'toto' } })
+    })
+
     it('Should success with the correct parameters', async function () {
-      await makeGetRequest({ url: server.url, path, statusCodeExpected: 200 })
+      await makeGetRequest({ url: server.url, path, statusCodeExpected: 200, query: { skipCount: false } })
     })
   })
 
@@ -178,7 +182,7 @@ describe('Test videos API validator', function () {
   describe('When adding a video', function () {
     let baseCorrectParams
     const baseCorrectAttaches = {
-      'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')
+      videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.webm')
     }
 
     before(function () {
@@ -326,7 +330,7 @@ describe('Test videos API validator', function () {
     })
 
     it('Should fail with a bad originally published at attribute', async function () {
-      const fields = immutableAssign(baseCorrectParams, { 'originallyPublishedAt': 'toto' })
+      const fields = immutableAssign(baseCorrectParams, { originallyPublishedAt: 'toto' })
       const attaches = baseCorrectAttaches
 
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -341,12 +345,12 @@ describe('Test videos API validator', function () {
     it('Should fail with an incorrect input file', async function () {
       const fields = baseCorrectParams
       let attaches = {
-        'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm')
+        videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short_fake.webm')
       }
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
 
       attaches = {
-        'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv')
+        videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mkv')
       }
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
     })
@@ -354,8 +358,8 @@ describe('Test videos API validator', function () {
     it('Should fail with an incorrect thumbnail file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
-        'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+        thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
+        videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
       }
 
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -364,8 +368,8 @@ describe('Test videos API validator', function () {
     it('Should fail with a big thumbnail file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
-        'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+        thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
+        videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
       }
 
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -374,8 +378,8 @@ describe('Test videos API validator', function () {
     it('Should fail with an incorrect preview file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
-        'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+        previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png'),
+        videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
       }
 
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -384,8 +388,8 @@ describe('Test videos API validator', function () {
     it('Should fail with a big preview file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
-        'videofile': join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
+        previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png'),
+        videofile: join(root(), 'server', 'tests', 'fixtures', 'video_short.mp4')
       }
 
       await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -562,7 +566,7 @@ describe('Test videos API validator', function () {
     it('Should fail with an incorrect thumbnail file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
+        thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
       }
 
       await makeUploadRequest({
@@ -578,7 +582,7 @@ describe('Test videos API validator', function () {
     it('Should fail with a big thumbnail file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'thumbnailfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
+        thumbnailfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
       }
 
       await makeUploadRequest({
@@ -594,7 +598,7 @@ describe('Test videos API validator', function () {
     it('Should fail with an incorrect preview file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
+        previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar.png')
       }
 
       await makeUploadRequest({
@@ -610,7 +614,7 @@ describe('Test videos API validator', function () {
     it('Should fail with a big preview file', async function () {
       const fields = baseCorrectParams
       const attaches = {
-        'previewfile': join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
+        previewfile: join(root(), 'server', 'tests', 'fixtures', 'avatar-big.png')
       }
 
       await makeUploadRequest({