1 import * as request from 'supertest'
3 function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string) {
4 const path = '/api/v1/videos/' + videoId + '/comment-threads'
6 const req = request(url)
8 .query({ start: start })
9 .query({ count: count })
11 if (sort) req.query({ sort })
13 return req.set('Accept', 'application/json')
15 .expect('Content-Type', /json/)
18 function getVideoThreadComments (url: string, videoId: number | string, threadId: number) {
19 const path = '/api/v1/videos/' + videoId + '/comment-threads/' + threadId
23 .set('Accept', 'application/json')
25 .expect('Content-Type', /json/)
28 function addVideoCommentThread (url: string, token: string, videoId: number | string, text: string, expectedStatus = 200) {
29 const path = '/api/v1/videos/' + videoId + '/comment-threads'
34 .set('Accept', 'application/json')
35 .set('Authorization', 'Bearer ' + token)
36 .expect(expectedStatus)
39 function addVideoCommentReply (
42 videoId: number | string,
43 inReplyToCommentId: number,
47 const path = '/api/v1/videos/' + videoId + '/comments/' + inReplyToCommentId
52 .set('Accept', 'application/json')
53 .set('Authorization', 'Bearer ' + token)
54 .expect(expectedStatus)
57 // ---------------------------------------------------------------------------
60 getVideoCommentThreads,
61 getVideoThreadComments,
62 addVideoCommentThread,