diff options
Diffstat (limited to 'server/tests/api/check-params/video-comments.ts')
-rw-r--r-- | server/tests/api/check-params/video-comments.ts | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index cdb48a276..c11660d07 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
3 | import 'mocha' | 4 | import 'mocha' |
4 | import { | 5 | import { |
5 | flushTests, killallServers, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, | 6 | flushTests, killallServers, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, |
@@ -8,6 +9,8 @@ import { | |||
8 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' | 9 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' |
9 | import { addVideoCommentThread } from '../../utils/videos/video-comments' | 10 | import { addVideoCommentThread } from '../../utils/videos/video-comments' |
10 | 11 | ||
12 | const expect = chai.expect | ||
13 | |||
11 | describe('Test video comments API validator', function () { | 14 | describe('Test video comments API validator', function () { |
12 | let pathThread: string | 15 | let pathThread: string |
13 | let pathComment: string | 16 | let pathComment: string |
@@ -42,17 +45,14 @@ describe('Test video comments API validator', function () { | |||
42 | describe('When listing video comment threads', function () { | 45 | describe('When listing video comment threads', function () { |
43 | it('Should fail with a bad start pagination', async function () { | 46 | it('Should fail with a bad start pagination', async function () { |
44 | await checkBadStartPagination(server.url, pathThread, server.accessToken) | 47 | await checkBadStartPagination(server.url, pathThread, server.accessToken) |
45 | |||
46 | }) | 48 | }) |
47 | 49 | ||
48 | it('Should fail with a bad count pagination', async function () { | 50 | it('Should fail with a bad count pagination', async function () { |
49 | await checkBadCountPagination(server.url, pathThread, server.accessToken) | 51 | await checkBadCountPagination(server.url, pathThread, server.accessToken) |
50 | |||
51 | }) | 52 | }) |
52 | 53 | ||
53 | it('Should fail with an incorrect sort', async function () { | 54 | it('Should fail with an incorrect sort', async function () { |
54 | await checkBadSortPagination(server.url, pathThread, server.accessToken) | 55 | await checkBadSortPagination(server.url, pathThread, server.accessToken) |
55 | |||
56 | }) | 56 | }) |
57 | 57 | ||
58 | it('Should fail with an incorrect video', async function () { | 58 | it('Should fail with an incorrect video', async function () { |
@@ -185,6 +185,35 @@ describe('Test video comments API validator', function () { | |||
185 | }) | 185 | }) |
186 | }) | 186 | }) |
187 | 187 | ||
188 | describe('When a video has comments disabled', function () { | ||
189 | before(async function () { | ||
190 | const res = await uploadVideo(server.url, server.accessToken, { commentsEnabled: false }) | ||
191 | videoUUID = res.body.video.uuid | ||
192 | pathThread = '/api/v1/videos/' + videoUUID + '/comment-threads' | ||
193 | }) | ||
194 | |||
195 | it('Should return an empty thread list', async function () { | ||
196 | const res = await makeGetRequest({ | ||
197 | url: server.url, | ||
198 | path: pathThread, | ||
199 | statusCodeExpected: 200 | ||
200 | }) | ||
201 | expect(res.body.total).to.equal(0) | ||
202 | expect(res.body.data).to.have.lengthOf(0) | ||
203 | }) | ||
204 | |||
205 | it('Should return an thread comments list') | ||
206 | |||
207 | it('Should return conflict on thread add', async function () { | ||
208 | const fields = { | ||
209 | text: 'super comment' | ||
210 | } | ||
211 | await makePostBodyRequest({ url: server.url, path: pathThread, token: server.accessToken, fields, statusCodeExpected: 409 }) | ||
212 | }) | ||
213 | |||
214 | it('Should return conflict on comment thread add') | ||
215 | }) | ||
216 | |||
188 | after(async function () { | 217 | after(async function () { |
189 | killallServers([ server ]) | 218 | killallServers([ server ]) |
190 | 219 | ||