diff options
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/video-playlists.ts | 5 | ||||
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 35 |
2 files changed, 30 insertions, 10 deletions
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts index 46ec00d46..179ae9201 100644 --- a/server/tests/api/check-params/video-playlists.ts +++ b/server/tests/api/check-params/video-playlists.ts | |||
@@ -346,11 +346,6 @@ describe('Test video playlists API validator', function () { | |||
346 | const res = await addVideoInPlaylist(params) | 346 | const res = await addVideoInPlaylist(params) |
347 | playlistElementId = res.body.videoPlaylistElement.id | 347 | playlistElementId = res.body.videoPlaylistElement.id |
348 | }) | 348 | }) |
349 | |||
350 | it('Should fail if the video was already added in the playlist', async function () { | ||
351 | const params = getBase({}, { expectedStatus: 409 }) | ||
352 | await addVideoInPlaylist(params) | ||
353 | }) | ||
354 | }) | 349 | }) |
355 | 350 | ||
356 | describe('When updating an element in a playlist', function () { | 351 | describe('When updating an element in a playlist', function () { |
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 52b32998d..0bfb5bcd4 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -552,6 +552,9 @@ describe('Test video playlists', function () { | |||
552 | { | 552 | { |
553 | const res = await addVideo({ videoId: nsfwVideoServer1, startTimestamp: 5 }) | 553 | const res = await addVideo({ videoId: nsfwVideoServer1, startTimestamp: 5 }) |
554 | playlistElementNSFW = res.body.videoPlaylistElement.id | 554 | playlistElementNSFW = res.body.videoPlaylistElement.id |
555 | |||
556 | await addVideo({ videoId: nsfwVideoServer1, startTimestamp: 4 }) | ||
557 | await addVideo({ videoId: nsfwVideoServer1 }) | ||
555 | } | 558 | } |
556 | 559 | ||
557 | await waitJobs(servers) | 560 | await waitJobs(servers) |
@@ -563,10 +566,10 @@ describe('Test video playlists', function () { | |||
563 | for (const server of servers) { | 566 | for (const server of servers) { |
564 | const res = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 10) | 567 | const res = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 10) |
565 | 568 | ||
566 | expect(res.body.total).to.equal(6) | 569 | expect(res.body.total).to.equal(8) |
567 | 570 | ||
568 | const videoElements: VideoPlaylistElement[] = res.body.data | 571 | const videoElements: VideoPlaylistElement[] = res.body.data |
569 | expect(videoElements).to.have.lengthOf(6) | 572 | expect(videoElements).to.have.lengthOf(8) |
570 | 573 | ||
571 | expect(videoElements[0].video.name).to.equal('video 0 server 1') | 574 | expect(videoElements[0].video.name).to.equal('video 0 server 1') |
572 | expect(videoElements[0].position).to.equal(1) | 575 | expect(videoElements[0].position).to.equal(1) |
@@ -598,6 +601,16 @@ describe('Test video playlists', function () { | |||
598 | expect(videoElements[5].startTimestamp).to.equal(5) | 601 | expect(videoElements[5].startTimestamp).to.equal(5) |
599 | expect(videoElements[5].stopTimestamp).to.be.null | 602 | expect(videoElements[5].stopTimestamp).to.be.null |
600 | 603 | ||
604 | expect(videoElements[6].video.name).to.equal('NSFW video') | ||
605 | expect(videoElements[6].position).to.equal(7) | ||
606 | expect(videoElements[6].startTimestamp).to.equal(4) | ||
607 | expect(videoElements[6].stopTimestamp).to.be.null | ||
608 | |||
609 | expect(videoElements[7].video.name).to.equal('NSFW video') | ||
610 | expect(videoElements[7].position).to.equal(8) | ||
611 | expect(videoElements[7].startTimestamp).to.be.null | ||
612 | expect(videoElements[7].stopTimestamp).to.be.null | ||
613 | |||
601 | const res3 = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 2) | 614 | const res3 = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 2) |
602 | expect(res3.body.data).to.have.lengthOf(2) | 615 | expect(res3.body.data).to.have.lengthOf(2) |
603 | } | 616 | } |
@@ -807,6 +820,8 @@ describe('Test video playlists', function () { | |||
807 | 'video 1 server 3', | 820 | 'video 1 server 3', |
808 | 'video 3 server 1', | 821 | 'video 3 server 1', |
809 | 'video 4 server 1', | 822 | 'video 4 server 1', |
823 | 'NSFW video', | ||
824 | 'NSFW video', | ||
810 | 'NSFW video' | 825 | 'NSFW video' |
811 | ]) | 826 | ]) |
812 | } | 827 | } |
@@ -836,6 +851,8 @@ describe('Test video playlists', function () { | |||
836 | 'video 2 server 3', | 851 | 'video 2 server 3', |
837 | 'video 1 server 3', | 852 | 'video 1 server 3', |
838 | 'video 4 server 1', | 853 | 'video 4 server 1', |
854 | 'NSFW video', | ||
855 | 'NSFW video', | ||
839 | 'NSFW video' | 856 | 'NSFW video' |
840 | ]) | 857 | ]) |
841 | } | 858 | } |
@@ -865,7 +882,9 @@ describe('Test video playlists', function () { | |||
865 | 'video 2 server 3', | 882 | 'video 2 server 3', |
866 | 'NSFW video', | 883 | 'NSFW video', |
867 | 'video 1 server 3', | 884 | 'video 1 server 3', |
868 | 'video 4 server 1' | 885 | 'video 4 server 1', |
886 | 'NSFW video', | ||
887 | 'NSFW video' | ||
869 | ]) | 888 | ]) |
870 | 889 | ||
871 | for (let i = 1; i <= elements.length; i++) { | 890 | for (let i = 1; i <= elements.length; i++) { |
@@ -1023,10 +1042,10 @@ describe('Test video playlists', function () { | |||
1023 | for (const server of servers) { | 1042 | for (const server of servers) { |
1024 | const res = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 10) | 1043 | const res = await getPlaylistVideos(server.url, server.accessToken, playlistServer1UUID, 0, 10) |
1025 | 1044 | ||
1026 | expect(res.body.total).to.equal(4) | 1045 | expect(res.body.total).to.equal(6) |
1027 | 1046 | ||
1028 | const elements: VideoPlaylistElement[] = res.body.data | 1047 | const elements: VideoPlaylistElement[] = res.body.data |
1029 | expect(elements).to.have.lengthOf(4) | 1048 | expect(elements).to.have.lengthOf(6) |
1030 | 1049 | ||
1031 | expect(elements[0].video.name).to.equal('video 0 server 1') | 1050 | expect(elements[0].video.name).to.equal('video 0 server 1') |
1032 | expect(elements[0].position).to.equal(1) | 1051 | expect(elements[0].position).to.equal(1) |
@@ -1039,6 +1058,12 @@ describe('Test video playlists', function () { | |||
1039 | 1058 | ||
1040 | expect(elements[3].video.name).to.equal('video 4 server 1') | 1059 | expect(elements[3].video.name).to.equal('video 4 server 1') |
1041 | expect(elements[3].position).to.equal(4) | 1060 | expect(elements[3].position).to.equal(4) |
1061 | |||
1062 | expect(elements[4].video.name).to.equal('NSFW video') | ||
1063 | expect(elements[4].position).to.equal(5) | ||
1064 | |||
1065 | expect(elements[5].video.name).to.equal('NSFW video') | ||
1066 | expect(elements[5].position).to.equal(6) | ||
1042 | } | 1067 | } |
1043 | }) | 1068 | }) |
1044 | 1069 | ||