aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/videos.ts8
-rw-r--r--server/tests/api/server/follows.ts2
-rw-r--r--server/tests/api/server/handle-down.ts4
-rw-r--r--server/tests/api/videos/multiple-servers.ts20
-rw-r--r--server/tests/api/videos/single-server.ts14
-rw-r--r--server/tests/real-world/real-world.ts2
-rw-r--r--server/tests/utils/videos/videos.ts12
7 files changed, 31 insertions, 31 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 1d19daa60..da41f515b 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -105,7 +105,7 @@ describe('Test videos API validator', function () {
105 name: 'my super name', 105 name: 'my super name',
106 category: 5, 106 category: 5,
107 licence: 1, 107 licence: 1,
108 language: 6, 108 language: 'pt',
109 nsfw: false, 109 nsfw: false,
110 commentsEnabled: true, 110 commentsEnabled: true,
111 description: 'my super description', 111 description: 'my super description',
@@ -151,7 +151,7 @@ describe('Test videos API validator', function () {
151 }) 151 })
152 152
153 it('Should fail with a bad language', async function () { 153 it('Should fail with a bad language', async function () {
154 const fields = immutableAssign(baseCorrectParams, { language: 125 }) 154 const fields = immutableAssign(baseCorrectParams, { language: 'a'.repeat(15) })
155 const attaches = baseCorrectAttaches 155 const attaches = baseCorrectAttaches
156 156
157 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) 157 await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
@@ -359,7 +359,7 @@ describe('Test videos API validator', function () {
359 name: 'my super name', 359 name: 'my super name',
360 category: 5, 360 category: 5,
361 licence: 2, 361 licence: 2,
362 language: 6, 362 language: 'pt',
363 nsfw: false, 363 nsfw: false,
364 commentsEnabled: false, 364 commentsEnabled: false,
365 description: 'my super description', 365 description: 'my super description',
@@ -413,7 +413,7 @@ describe('Test videos API validator', function () {
413 }) 413 })
414 414
415 it('Should fail with a bad language', async function () { 415 it('Should fail with a bad language', async function () {
416 const fields = immutableAssign(baseCorrectParams, { language: 125 }) 416 const fields = immutableAssign(baseCorrectParams, { language: 'a'.repeat(15) })
417 417
418 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) 418 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
419 }) 419 })
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 010b488d8..9d619a7de 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -277,7 +277,7 @@ describe('Test follows', function () {
277 name: 'server3-4', 277 name: 'server3-4',
278 category: 2, 278 category: 2,
279 licence: 6, 279 licence: 6,
280 language: 3, 280 language: 'zh',
281 nsfw: true, 281 nsfw: true,
282 description: 'my super description', 282 description: 'my super description',
283 support: 'my super support text', 283 support: 'my super support text',
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index f5ff3e9e5..889825936 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -32,7 +32,7 @@ describe('Test handle downs', function () {
32 name: 'my super name for server 1', 32 name: 'my super name for server 1',
33 category: 5, 33 category: 5,
34 licence: 4, 34 licence: 4,
35 language: 9, 35 language: 'ja',
36 nsfw: true, 36 nsfw: true,
37 privacy: VideoPrivacy.PUBLIC, 37 privacy: VideoPrivacy.PUBLIC,
38 description: 'my super description for server 1', 38 description: 'my super description for server 1',
@@ -49,7 +49,7 @@ describe('Test handle downs', function () {
49 name: 'my super name for server 1', 49 name: 'my super name for server 1',
50 category: 5, 50 category: 5,
51 licence: 4, 51 licence: 4,
52 language: 9, 52 language: 'ja',
53 nsfw: true, 53 nsfw: true,
54 description: 'my super description for server 1', 54 description: 'my super description for server 1',
55 support: 'my super support text for server 1', 55 support: 'my super support text for server 1',
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index e31c7febd..2563939ec 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -89,7 +89,7 @@ describe('Test multiple servers', function () {
89 name: 'my super name for server 1', 89 name: 'my super name for server 1',
90 category: 5, 90 category: 5,
91 licence: 4, 91 licence: 4,
92 language: 9, 92 language: 'ja',
93 nsfw: true, 93 nsfw: true,
94 description: 'my super description for server 1', 94 description: 'my super description for server 1',
95 support: 'my super support text for server 1', 95 support: 'my super support text for server 1',
@@ -108,7 +108,7 @@ describe('Test multiple servers', function () {
108 name: 'my super name for server 1', 108 name: 'my super name for server 1',
109 category: 5, 109 category: 5,
110 licence: 4, 110 licence: 4,
111 language: 9, 111 language: 'ja',
112 nsfw: true, 112 nsfw: true,
113 description: 'my super description for server 1', 113 description: 'my super description for server 1',
114 support: 'my super support text for server 1', 114 support: 'my super support text for server 1',
@@ -159,7 +159,7 @@ describe('Test multiple servers', function () {
159 name: 'my super name for server 2', 159 name: 'my super name for server 2',
160 category: 4, 160 category: 4,
161 licence: 3, 161 licence: 3,
162 language: 11, 162 language: 'de',
163 nsfw: true, 163 nsfw: true,
164 description: 'my super description for server 2', 164 description: 'my super description for server 2',
165 support: 'my super support text for server 2', 165 support: 'my super support text for server 2',
@@ -180,7 +180,7 @@ describe('Test multiple servers', function () {
180 name: 'my super name for server 2', 180 name: 'my super name for server 2',
181 category: 4, 181 category: 4,
182 licence: 3, 182 licence: 3,
183 language: 11, 183 language: 'de',
184 nsfw: true, 184 nsfw: true,
185 description: 'my super description for server 2', 185 description: 'my super description for server 2',
186 support: 'my super support text for server 2', 186 support: 'my super support text for server 2',
@@ -238,7 +238,7 @@ describe('Test multiple servers', function () {
238 name: 'my super name for server 3', 238 name: 'my super name for server 3',
239 category: 6, 239 category: 6,
240 licence: 5, 240 licence: 5,
241 language: 11, 241 language: 'de',
242 nsfw: true, 242 nsfw: true,
243 description: 'my super description for server 3', 243 description: 'my super description for server 3',
244 support: 'my super support text for server 3', 244 support: 'my super support text for server 3',
@@ -251,7 +251,7 @@ describe('Test multiple servers', function () {
251 name: 'my super name for server 3-2', 251 name: 'my super name for server 3-2',
252 category: 7, 252 category: 7,
253 licence: 6, 253 licence: 6,
254 language: 12, 254 language: 'ko',
255 nsfw: false, 255 nsfw: false,
256 description: 'my super description for server 3-2', 256 description: 'my super description for server 3-2',
257 support: 'my super support text for server 3-2', 257 support: 'my super support text for server 3-2',
@@ -286,7 +286,7 @@ describe('Test multiple servers', function () {
286 name: 'my super name for server 3', 286 name: 'my super name for server 3',
287 category: 6, 287 category: 6,
288 licence: 5, 288 licence: 5,
289 language: 11, 289 language: 'de',
290 nsfw: true, 290 nsfw: true,
291 description: 'my super description for server 3', 291 description: 'my super description for server 3',
292 support: 'my super support text for server 3', 292 support: 'my super support text for server 3',
@@ -318,7 +318,7 @@ describe('Test multiple servers', function () {
318 name: 'my super name for server 3-2', 318 name: 'my super name for server 3-2',
319 category: 7, 319 category: 7,
320 licence: 6, 320 licence: 6,
321 language: 12, 321 language: 'ko',
322 nsfw: false, 322 nsfw: false,
323 description: 'my super description for server 3-2', 323 description: 'my super description for server 3-2',
324 support: 'my super support text for server 3-2', 324 support: 'my super support text for server 3-2',
@@ -597,7 +597,7 @@ describe('Test multiple servers', function () {
597 name: 'my super video updated', 597 name: 'my super video updated',
598 category: 10, 598 category: 10,
599 licence: 7, 599 licence: 7,
600 language: 13, 600 language: 'fr',
601 nsfw: true, 601 nsfw: true,
602 description: 'my super description updated', 602 description: 'my super description updated',
603 support: 'my super support text updated', 603 support: 'my super support text updated',
@@ -626,7 +626,7 @@ describe('Test multiple servers', function () {
626 name: 'my super video updated', 626 name: 'my super video updated',
627 category: 10, 627 category: 10,
628 licence: 7, 628 licence: 7,
629 language: 13, 629 language: 'fr',
630 nsfw: true, 630 nsfw: true,
631 description: 'my super description updated', 631 description: 'my super description updated',
632 support: 'my super support text updated', 632 support: 'my super support text updated',
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 7c4bdf8bc..5e163e9df 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -23,7 +23,7 @@ describe('Test a single server', function () {
23 name: 'my super name', 23 name: 'my super name',
24 category: 2, 24 category: 2,
25 licence: 6, 25 licence: 6,
26 language: 3, 26 language: 'zh',
27 nsfw: true, 27 nsfw: true,
28 description: 'my super description', 28 description: 'my super description',
29 support: 'my super support text', 29 support: 'my super support text',
@@ -54,7 +54,7 @@ describe('Test a single server', function () {
54 name: 'my super video updated', 54 name: 'my super video updated',
55 category: 4, 55 category: 4,
56 licence: 2, 56 licence: 2,
57 language: 5, 57 language: 'ar',
58 nsfw: false, 58 nsfw: false,
59 description: 'my super description updated', 59 description: 'my super description updated',
60 support: 'my super support text updated', 60 support: 'my super support text updated',
@@ -115,7 +115,7 @@ describe('Test a single server', function () {
115 const languages = res.body 115 const languages = res.body
116 expect(Object.keys(languages)).to.have.length.above(5) 116 expect(Object.keys(languages)).to.have.length.above(5)
117 117
118 expect(languages[3]).to.equal('Mandarin') 118 expect(languages['ru']).to.equal('Russian')
119 }) 119 })
120 120
121 it('Should list video privacies', async function () { 121 it('Should list video privacies', async function () {
@@ -222,8 +222,8 @@ describe('Test a single server', function () {
222 // expect(video.categoryLabel).to.equal('Films') 222 // expect(video.categoryLabel).to.equal('Films')
223 // expect(video.licence).to.equal(6) 223 // expect(video.licence).to.equal(6)
224 // expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 224 // expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
225 // expect(video.language).to.equal(3) 225 // expect(video.language).to.equal('zh')
226 // expect(video.languageLabel).to.equal('Mandarin') 226 // expect(video.languageLabel).to.equal('Chinese')
227 // expect(video.nsfw).to.be.ok 227 // expect(video.nsfw).to.be.ok
228 // expect(video.description).to.equal('my super description') 228 // expect(video.description).to.equal('my super description')
229 // expect(video.account.name).to.equal('root') 229 // expect(video.account.name).to.equal('root')
@@ -292,7 +292,7 @@ describe('Test a single server', function () {
292 description: video + ' description', 292 description: video + ' description',
293 category: 2, 293 category: 2,
294 licence: 1, 294 licence: 1,
295 language: 1, 295 language: 'en',
296 nsfw: true, 296 nsfw: true,
297 tags: [ 'tag1', 'tag2', 'tag3' ], 297 tags: [ 'tag1', 'tag2', 'tag3' ],
298 fixture: video 298 fixture: video
@@ -458,7 +458,7 @@ describe('Test a single server', function () {
458 name: 'my super video updated', 458 name: 'my super video updated',
459 category: 4, 459 category: 4,
460 licence: 2, 460 licence: 2,
461 language: 5, 461 language: 'ar',
462 nsfw: false, 462 nsfw: false,
463 description: 'my super description updated', 463 description: 'my super description updated',
464 commentsEnabled: false, 464 commentsEnabled: false,
diff --git a/server/tests/real-world/real-world.ts b/server/tests/real-world/real-world.ts
index ae02ef64d..b7375f778 100644
--- a/server/tests/real-world/real-world.ts
+++ b/server/tests/real-world/real-world.ts
@@ -182,7 +182,7 @@ function upload (servers: ServerInfo[], numServer: number) {
182 category: 4, 182 category: 4,
183 nsfw: false, 183 nsfw: false,
184 licence: 2, 184 licence: 2,
185 language: 1, 185 language: 'en',
186 description: Date.now() + ' description', 186 description: Date.now() + ' description',
187 tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ], 187 tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ],
188 fixture: 'video_short1.webm' 188 fixture: 'video_short1.webm'
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 5e186147e..943c85cc7 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -24,7 +24,7 @@ type VideoAttributes = {
24 name?: string 24 name?: string
25 category?: number 25 category?: number
26 licence?: number 26 licence?: number
27 language?: number 27 language?: string
28 nsfw?: boolean 28 nsfw?: boolean
29 commentsEnabled?: boolean 29 commentsEnabled?: boolean
30 description?: string 30 description?: string
@@ -284,7 +284,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg
284 name: 'my super video', 284 name: 'my super video',
285 category: 5, 285 category: 5,
286 licence: 4, 286 licence: 4,
287 language: 3, 287 language: 'zh',
288 channelId: defaultChannelId, 288 channelId: defaultChannelId,
289 nsfw: true, 289 nsfw: true,
290 description: 'my super description', 290 description: 'my super description',
@@ -403,7 +403,7 @@ async function completeVideoCheck (
403 name: string 403 name: string
404 category: number 404 category: number
405 licence: number 405 licence: number
406 language: number 406 language: string
407 nsfw: boolean 407 nsfw: boolean
408 commentsEnabled: boolean 408 commentsEnabled: boolean
409 description: string 409 description: string
@@ -437,11 +437,11 @@ async function completeVideoCheck (
437 437
438 expect(video.name).to.equal(attributes.name) 438 expect(video.name).to.equal(attributes.name)
439 expect(video.category.id).to.equal(attributes.category) 439 expect(video.category.id).to.equal(attributes.category)
440 expect(video.category.label).to.equal(VIDEO_CATEGORIES[attributes.category] || 'Misc') 440 expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Misc')
441 expect(video.licence.id).to.equal(attributes.licence) 441 expect(video.licence.id).to.equal(attributes.licence)
442 expect(video.licence.label).to.equal(VIDEO_LICENCES[attributes.licence] || 'Unknown') 442 expect(video.licence.label).to.equal(attributes.licence !== null ? VIDEO_LICENCES[attributes.licence] : 'Unknown')
443 expect(video.language.id).to.equal(attributes.language) 443 expect(video.language.id).to.equal(attributes.language)
444 expect(video.language.label).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown') 444 expect(video.language.label).to.equal(attributes.language !== null ? VIDEO_LANGUAGES[attributes.language] : 'Unknown')
445 expect(video.privacy.id).to.deep.equal(attributes.privacy) 445 expect(video.privacy.id).to.deep.equal(attributes.privacy)
446 expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy]) 446 expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
447 expect(video.nsfw).to.equal(attributes.nsfw) 447 expect(video.nsfw).to.equal(attributes.nsfw)