diff options
Diffstat (limited to 'shared/extra-utils/videos/video-comments.ts')
-rw-r--r-- | shared/extra-utils/videos/video-comments.ts | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/shared/extra-utils/videos/video-comments.ts b/shared/extra-utils/videos/video-comments.ts index 0b0df81dc..71b9f875a 100644 --- a/shared/extra-utils/videos/video-comments.ts +++ b/shared/extra-utils/videos/video-comments.ts | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | import * as request from 'supertest' | 3 | import * as request from 'supertest' |
4 | import { makeDeleteRequest, makeGetRequest } from '../requests/requests' | 4 | import { makeDeleteRequest, makeGetRequest } from '../requests/requests' |
5 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
5 | 6 | ||
6 | function getAdminVideoComments (options: { | 7 | function getAdminVideoComments (options: { |
7 | url: string | 8 | url: string |
@@ -33,7 +34,7 @@ function getAdminVideoComments (options: { | |||
33 | path, | 34 | path, |
34 | token, | 35 | token, |
35 | query, | 36 | query, |
36 | statusCodeExpected: 200 | 37 | statusCodeExpected: HttpStatusCode.OK_200 |
37 | }) | 38 | }) |
38 | } | 39 | } |
39 | 40 | ||
@@ -49,7 +50,7 @@ function getVideoCommentThreads (url: string, videoId: number | string, start: n | |||
49 | if (token) req.set('Authorization', 'Bearer ' + token) | 50 | if (token) req.set('Authorization', 'Bearer ' + token) |
50 | 51 | ||
51 | return req.set('Accept', 'application/json') | 52 | return req.set('Accept', 'application/json') |
52 | .expect(200) | 53 | .expect(HttpStatusCode.OK_200) |
53 | .expect('Content-Type', /json/) | 54 | .expect('Content-Type', /json/) |
54 | } | 55 | } |
55 | 56 | ||
@@ -62,11 +63,17 @@ function getVideoThreadComments (url: string, videoId: number | string, threadId | |||
62 | 63 | ||
63 | if (token) req.set('Authorization', 'Bearer ' + token) | 64 | if (token) req.set('Authorization', 'Bearer ' + token) |
64 | 65 | ||
65 | return req.expect(200) | 66 | return req.expect(HttpStatusCode.OK_200) |
66 | .expect('Content-Type', /json/) | 67 | .expect('Content-Type', /json/) |
67 | } | 68 | } |
68 | 69 | ||
69 | function addVideoCommentThread (url: string, token: string, videoId: number | string, text: string, expectedStatus = 200) { | 70 | function addVideoCommentThread ( |
71 | url: string, | ||
72 | token: string, | ||
73 | videoId: number | string, | ||
74 | text: string, | ||
75 | expectedStatus = HttpStatusCode.OK_200 | ||
76 | ) { | ||
70 | const path = '/api/v1/videos/' + videoId + '/comment-threads' | 77 | const path = '/api/v1/videos/' + videoId + '/comment-threads' |
71 | 78 | ||
72 | return request(url) | 79 | return request(url) |
@@ -83,7 +90,7 @@ function addVideoCommentReply ( | |||
83 | videoId: number | string, | 90 | videoId: number | string, |
84 | inReplyToCommentId: number, | 91 | inReplyToCommentId: number, |
85 | text: string, | 92 | text: string, |
86 | expectedStatus = 200 | 93 | expectedStatus = HttpStatusCode.OK_200 |
87 | ) { | 94 | ) { |
88 | const path = '/api/v1/videos/' + videoId + '/comments/' + inReplyToCommentId | 95 | const path = '/api/v1/videos/' + videoId + '/comments/' + inReplyToCommentId |
89 | 96 | ||
@@ -106,7 +113,7 @@ function deleteVideoComment ( | |||
106 | token: string, | 113 | token: string, |
107 | videoId: number | string, | 114 | videoId: number | string, |
108 | commentId: number, | 115 | commentId: number, |
109 | statusCodeExpected = 204 | 116 | statusCodeExpected = HttpStatusCode.NO_CONTENT_204 |
110 | ) { | 117 | ) { |
111 | const path = '/api/v1/videos/' + videoId + '/comments/' + commentId | 118 | const path = '/api/v1/videos/' + videoId + '/comments/' + commentId |
112 | 119 | ||