From 47564bbe2eeb2baae9b7e3f9b2b8d16522bc7e04 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Jan 2018 10:12:36 +0100 Subject: Add ability to disable video comments --- server/tests/api/check-params/videos.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'server/tests/api/check-params/videos.ts') diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index b9484afc4..5c067dc96 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -100,6 +100,7 @@ describe('Test videos API validator', function () { licence: 1, language: 6, nsfw: false, + commentsEnabled: true, description: 'my super description', tags: [ 'tag1', 'tag2' ], privacy: VideoPrivacy.PUBLIC, @@ -162,6 +163,20 @@ describe('Test videos API validator', function () { await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) }) + it('Should fail without commentsEnabled attribute', async function () { + const fields = omit(baseCorrectParams, 'commentsEnabled') + const attaches = baseCorrectAttaches + + await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) + }) + + it('Should fail with a bad commentsEnabled attribute', async function () { + const fields = immutableAssign(baseCorrectParams, { commentsEnabled: 2 }) + const attaches = baseCorrectAttaches + + await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) + }) + it('Should fail with a long description', async function () { const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) }) const attaches = baseCorrectAttaches @@ -291,6 +306,7 @@ describe('Test videos API validator', function () { licence: 2, language: 6, nsfw: false, + commentsEnabled: false, description: 'my super description', privacy: VideoPrivacy.PUBLIC, tags: [ 'tag1', 'tag2' ] @@ -354,6 +370,12 @@ describe('Test videos API validator', function () { await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) }) + it('Should fail with a bad commentsEnabled attribute', async function () { + const fields = immutableAssign(baseCorrectParams, { commentsEnabled: 2 }) + + await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) + }) + it('Should fail with a long description', async function () { const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) }) -- cgit v1.2.3