aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/videos/videos.ts')
-rw-r--r--server/tests/utils/videos/videos.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index aca51ee5d..c437c21b2 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -16,6 +16,7 @@ type VideoAttributes = {
16 licence?: number 16 licence?: number
17 language?: number 17 language?: number
18 nsfw?: boolean 18 nsfw?: boolean
19 commentsEnabled?: boolean
19 description?: string 20 description?: string
20 tags?: string[] 21 tags?: string[]
21 channelId?: number 22 channelId?: number
@@ -238,6 +239,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
238 description: 'my super description', 239 description: 'my super description',
239 tags: [ 'tag' ], 240 tags: [ 'tag' ],
240 privacy: VideoPrivacy.PUBLIC, 241 privacy: VideoPrivacy.PUBLIC,
242 commentsEnabled: true,
241 fixture: 'video_short.webm' 243 fixture: 'video_short.webm'
242 } 244 }
243 attributes = Object.assign(attributes, videoAttributesArg) 245 attributes = Object.assign(attributes, videoAttributesArg)
@@ -250,6 +252,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
250 .field('category', attributes.category.toString()) 252 .field('category', attributes.category.toString())
251 .field('licence', attributes.licence.toString()) 253 .field('licence', attributes.licence.toString())
252 .field('nsfw', JSON.stringify(attributes.nsfw)) 254 .field('nsfw', JSON.stringify(attributes.nsfw))
255 .field('commentsEnabled', JSON.stringify(attributes.commentsEnabled))
253 .field('description', attributes.description) 256 .field('description', attributes.description)
254 .field('privacy', attributes.privacy.toString()) 257 .field('privacy', attributes.privacy.toString())
255 .field('channelId', attributes.channelId) 258 .field('channelId', attributes.channelId)
@@ -273,7 +276,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
273 .expect(specialStatus) 276 .expect(specialStatus)
274} 277}
275 278
276function updateVideo (url: string, accessToken: string, id: number, attributes: VideoAttributes, specialStatus = 204) { 279function updateVideo (url: string, accessToken: string, id: number | string, attributes: VideoAttributes, specialStatus = 204) {
277 const path = '/api/v1/videos/' + id 280 const path = '/api/v1/videos/' + id
278 const body = {} 281 const body = {}
279 282
@@ -281,7 +284,8 @@ function updateVideo (url: string, accessToken: string, id: number, attributes:
281 if (attributes.category) body['category'] = attributes.category 284 if (attributes.category) body['category'] = attributes.category
282 if (attributes.licence) body['licence'] = attributes.licence 285 if (attributes.licence) body['licence'] = attributes.licence
283 if (attributes.language) body['language'] = attributes.language 286 if (attributes.language) body['language'] = attributes.language
284 if (attributes.nsfw) body['nsfw'] = attributes.nsfw 287 if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw)
288 if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled)
285 if (attributes.description) body['description'] = attributes.description 289 if (attributes.description) body['description'] = attributes.description
286 if (attributes.tags) body['tags'] = attributes.tags 290 if (attributes.tags) body['tags'] = attributes.tags
287 if (attributes.privacy) body['privacy'] = attributes.privacy 291 if (attributes.privacy) body['privacy'] = attributes.privacy
@@ -326,6 +330,7 @@ async function completeVideoCheck (
326 licence: number 330 licence: number
327 language: number 331 language: number
328 nsfw: boolean 332 nsfw: boolean
333 commentsEnabled: boolean
329 description: string 334 description: string
330 host: string 335 host: string
331 account: string 336 account: string
@@ -376,6 +381,7 @@ async function completeVideoCheck (
376 expect(videoDetails.privacy).to.deep.equal(attributes.privacy) 381 expect(videoDetails.privacy).to.deep.equal(attributes.privacy)
377 expect(videoDetails.privacyLabel).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy]) 382 expect(videoDetails.privacyLabel).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
378 expect(videoDetails.account.name).to.equal(attributes.account) 383 expect(videoDetails.account.name).to.equal(attributes.account)
384 expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
379 385
380 expect(videoDetails.channel.name).to.equal(attributes.channel.name) 386 expect(videoDetails.channel.name).to.equal(attributes.channel.name)
381 expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal) 387 expect(videoDetails.channel.isLocal).to.equal(attributes.channel.isLocal)