aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/single-server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/single-server.ts')
-rw-r--r--server/tests/api/single-server.ts112
1 files changed, 58 insertions, 54 deletions
diff --git a/server/tests/api/single-server.ts b/server/tests/api/single-server.ts
index 041d13225..fe192d391 100644
--- a/server/tests/api/single-server.ts
+++ b/server/tests/api/single-server.ts
@@ -225,7 +225,7 @@ describe('Test a single server', function () {
225 expect(video.views).to.equal(3) 225 expect(video.views).to.equal(3)
226 }) 226 })
227 227
228 it('Should search the video by name by default', async function () { 228 it('Should search the video by name', async function () {
229 const res = await searchVideo(server.url, 'my') 229 const res = await searchVideo(server.url, 'my')
230 230
231 expect(res.body.total).to.equal(1) 231 expect(res.body.total).to.equal(1)
@@ -279,35 +279,36 @@ describe('Test a single server', function () {
279 // }) 279 // })
280 // }) 280 // })
281 281
282 it('Should search the video by tag', async function () { 282 // Not implemented yet
283 const res = await searchVideo(server.url, 'tag1', 'tags') 283 // it('Should search the video by tag', async function () {
284 284 // const res = await searchVideo(server.url, 'tag1')
285 expect(res.body.total).to.equal(1) 285 //
286 expect(res.body.data).to.be.an('array') 286 // expect(res.body.total).to.equal(1)
287 expect(res.body.data.length).to.equal(1) 287 // expect(res.body.data).to.be.an('array')
288 288 // expect(res.body.data.length).to.equal(1)
289 const video = res.body.data[0] 289 //
290 expect(video.name).to.equal('my super name') 290 // const video = res.body.data[0]
291 expect(video.category).to.equal(2) 291 // expect(video.name).to.equal('my super name')
292 expect(video.categoryLabel).to.equal('Films') 292 // expect(video.category).to.equal(2)
293 expect(video.licence).to.equal(6) 293 // expect(video.categoryLabel).to.equal('Films')
294 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 294 // expect(video.licence).to.equal(6)
295 expect(video.language).to.equal(3) 295 // expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
296 expect(video.languageLabel).to.equal('Mandarin') 296 // expect(video.language).to.equal(3)
297 expect(video.nsfw).to.be.ok 297 // expect(video.languageLabel).to.equal('Mandarin')
298 expect(video.description).to.equal('my super description') 298 // expect(video.nsfw).to.be.ok
299 expect(video.serverHost).to.equal('localhost:9001') 299 // expect(video.description).to.equal('my super description')
300 expect(video.account).to.equal('root') 300 // expect(video.serverHost).to.equal('localhost:9001')
301 expect(video.isLocal).to.be.true 301 // expect(video.account).to.equal('root')
302 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ]) 302 // expect(video.isLocal).to.be.true
303 expect(dateIsValid(video.createdAt)).to.be.true 303 // expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
304 expect(dateIsValid(video.updatedAt)).to.be.true 304 // expect(dateIsValid(video.createdAt)).to.be.true
305 305 // expect(dateIsValid(video.updatedAt)).to.be.true
306 const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath) 306 //
307 expect(test).to.equal(true) 307 // const test = await testVideoImage(server.url, 'video_short.webm', video.thumbnailPath)
308 }) 308 // expect(test).to.equal(true)
309 // })
309 310
310 it('Should not find a search by name by default', async function () { 311 it('Should not find a search by name', async function () {
311 const res = await searchVideo(server.url, 'hello') 312 const res = await searchVideo(server.url, 'hello')
312 313
313 expect(res.body.total).to.equal(0) 314 expect(res.body.total).to.equal(0)
@@ -315,21 +316,23 @@ describe('Test a single server', function () {
315 expect(res.body.data.length).to.equal(0) 316 expect(res.body.data.length).to.equal(0)
316 }) 317 })
317 318
318 it('Should not find a search by author', async function () { 319 // Not implemented yet
319 const res = await searchVideo(server.url, 'hello', 'account') 320 // it('Should not find a search by author', async function () {
320 321 // const res = await searchVideo(server.url, 'hello')
321 expect(res.body.total).to.equal(0) 322 //
322 expect(res.body.data).to.be.an('array') 323 // expect(res.body.total).to.equal(0)
323 expect(res.body.data.length).to.equal(0) 324 // expect(res.body.data).to.be.an('array')
324 }) 325 // expect(res.body.data.length).to.equal(0)
325 326 // })
326 it('Should not find a search by tag', async function () { 327 //
327 const res = await searchVideo(server.url, 'hello', 'tags') 328 // Not implemented yet
328 329 // it('Should not find a search by tag', async function () {
329 expect(res.body.total).to.equal(0) 330 // const res = await searchVideo(server.url, 'hello')
330 expect(res.body.data).to.be.an('array') 331 //
331 expect(res.body.data.length).to.equal(0) 332 // expect(res.body.total).to.equal(0)
332 }) 333 // expect(res.body.data).to.be.an('array')
334 // expect(res.body.data.length).to.equal(0)
335 // })
333 336
334 it('Should remove the video', async function () { 337 it('Should remove the video', async function () {
335 await removeVideo(server.url, server.accessToken, videoId) 338 await removeVideo(server.url, server.accessToken, videoId)
@@ -443,7 +446,7 @@ describe('Test a single server', function () {
443 }) 446 })
444 447
445 it('Should search the first video', async function () { 448 it('Should search the first video', async function () {
446 const res = await searchVideoWithPagination(server.url, 'webm', 'name', 0, 1, 'name') 449 const res = await searchVideoWithPagination(server.url, 'webm', 0, 1, 'name')
447 450
448 const videos = res.body.data 451 const videos = res.body.data
449 expect(res.body.total).to.equal(4) 452 expect(res.body.total).to.equal(4)
@@ -452,7 +455,7 @@ describe('Test a single server', function () {
452 }) 455 })
453 456
454 it('Should search the last two videos', async function () { 457 it('Should search the last two videos', async function () {
455 const res = await searchVideoWithPagination(server.url, 'webm', 'name', 2, 2, 'name') 458 const res = await searchVideoWithPagination(server.url, 'webm', 2, 2, 'name')
456 459
457 const videos = res.body.data 460 const videos = res.body.data
458 expect(res.body.total).to.equal(4) 461 expect(res.body.total).to.equal(4)
@@ -462,20 +465,21 @@ describe('Test a single server', function () {
462 }) 465 })
463 466
464 it('Should search all the webm videos', async function () { 467 it('Should search all the webm videos', async function () {
465 const res = await searchVideoWithPagination(server.url, 'webm', 'name', 0, 15) 468 const res = await searchVideoWithPagination(server.url, 'webm', 0, 15)
466 469
467 const videos = res.body.data 470 const videos = res.body.data
468 expect(res.body.total).to.equal(4) 471 expect(res.body.total).to.equal(4)
469 expect(videos.length).to.equal(4) 472 expect(videos.length).to.equal(4)
470 }) 473 })
471 474
472 it('Should search all the root author videos', async function () { 475 // Not implemented yet
473 const res = await searchVideoWithPagination(server.url, 'root', 'account', 0, 15) 476 // it('Should search all the root author videos', async function () {
474 477 // const res = await searchVideoWithPagination(server.url, 'root', 0, 15)
475 const videos = res.body.data 478 //
476 expect(res.body.total).to.equal(6) 479 // const videos = res.body.data
477 expect(videos.length).to.equal(6) 480 // expect(res.body.total).to.equal(6)
478 }) 481 // expect(videos.length).to.equal(6)
482 // })
479 483
480 // Not implemented yet 484 // Not implemented yet
481 // it('Should search all the 9001 port videos', async function () { 485 // it('Should search all the 9001 port videos', async function () {