diff options
Diffstat (limited to 'server/tests/api/videos/video-playlists.ts')
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index baa2b3b8c..931491406 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -10,7 +10,7 @@ import { | |||
10 | createVideoPlaylist, | 10 | createVideoPlaylist, |
11 | deleteVideoChannel, | 11 | deleteVideoChannel, |
12 | deleteVideoPlaylist, | 12 | deleteVideoPlaylist, |
13 | doubleFollow, | 13 | doubleFollow, doVideosExistInMyPlaylist, |
14 | flushAndRunMultipleServers, | 14 | flushAndRunMultipleServers, |
15 | flushTests, | 15 | flushTests, |
16 | getAccountPlaylistsList, | 16 | getAccountPlaylistsList, |
@@ -41,6 +41,7 @@ import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/ | |||
41 | import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model' | 41 | import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model' |
42 | import { Video } from '../../../../shared/models/videos' | 42 | import { Video } from '../../../../shared/models/videos' |
43 | import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' | 43 | import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' |
44 | import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' | ||
44 | 45 | ||
45 | const expect = chai.expect | 46 | const expect = chai.expect |
46 | 47 | ||
@@ -624,6 +625,45 @@ describe('Test video playlists', function () { | |||
624 | } | 625 | } |
625 | }) | 626 | }) |
626 | 627 | ||
628 | it('Should check videos existence in my playlist', async function () { | ||
629 | const videoIds = [ | ||
630 | servers[0].videos[0].id, | ||
631 | 42000, | ||
632 | servers[0].videos[3].id, | ||
633 | 43000, | ||
634 | servers[0].videos[4].id | ||
635 | ] | ||
636 | const res = await doVideosExistInMyPlaylist(servers[ 0 ].url, servers[ 0 ].accessToken, videoIds) | ||
637 | const obj = res.body as VideoExistInPlaylist | ||
638 | |||
639 | { | ||
640 | const elem = obj[servers[0].videos[0].id] | ||
641 | expect(elem).to.have.lengthOf(1) | ||
642 | expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id) | ||
643 | expect(elem[ 0 ].startTimestamp).to.equal(15) | ||
644 | expect(elem[ 0 ].stopTimestamp).to.equal(28) | ||
645 | } | ||
646 | |||
647 | { | ||
648 | const elem = obj[servers[0].videos[3].id] | ||
649 | expect(elem).to.have.lengthOf(1) | ||
650 | expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id) | ||
651 | expect(elem[ 0 ].startTimestamp).to.equal(1) | ||
652 | expect(elem[ 0 ].stopTimestamp).to.equal(35) | ||
653 | } | ||
654 | |||
655 | { | ||
656 | const elem = obj[servers[0].videos[4].id] | ||
657 | expect(elem).to.have.lengthOf(1) | ||
658 | expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id) | ||
659 | expect(elem[ 0 ].startTimestamp).to.equal(45) | ||
660 | expect(elem[ 0 ].stopTimestamp).to.equal(null) | ||
661 | } | ||
662 | |||
663 | expect(obj[42000]).to.have.lengthOf(0) | ||
664 | expect(obj[43000]).to.have.lengthOf(0) | ||
665 | }) | ||
666 | |||
627 | it('Should delete some elements', async function () { | 667 | it('Should delete some elements', async function () { |
628 | this.timeout(30000) | 668 | this.timeout(30000) |
629 | 669 | ||