diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/videos/video-playlists.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts index 931491406..358a064ff 100644 --- a/server/tests/api/videos/video-playlists.ts +++ b/server/tests/api/videos/video-playlists.ts | |||
@@ -664,6 +664,37 @@ describe('Test video playlists', function () { | |||
664 | expect(obj[43000]).to.have.lengthOf(0) | 664 | expect(obj[43000]).to.have.lengthOf(0) |
665 | }) | 665 | }) |
666 | 666 | ||
667 | it('Should automatically update updatedAt field of playlists', async function () { | ||
668 | const server = servers[1] | ||
669 | const videoId = servers[1].videos[5].id | ||
670 | |||
671 | async function getPlaylistNames () { | ||
672 | const res = await getAccountPlaylistsListWithToken(server.url, server.accessToken, 'root', 0, 5, undefined, '-updatedAt') | ||
673 | |||
674 | return (res.body.data as VideoPlaylist[]).map(p => p.displayName) | ||
675 | } | ||
676 | |||
677 | const elementAttrs = { videoId } | ||
678 | await addVideoInPlaylist({ url: server.url, token: server.accessToken, playlistId: playlistServer2Id1, elementAttrs }) | ||
679 | await addVideoInPlaylist({ url: server.url, token: server.accessToken, playlistId: playlistServer2Id2, elementAttrs }) | ||
680 | |||
681 | const names1 = await getPlaylistNames() | ||
682 | expect(names1[0]).to.equal('playlist 3 updated') | ||
683 | expect(names1[1]).to.equal('playlist 2') | ||
684 | |||
685 | await removeVideoFromPlaylist({ url: server.url, token: server.accessToken, playlistId: playlistServer2Id1, videoId }) | ||
686 | |||
687 | const names2 = await getPlaylistNames() | ||
688 | expect(names2[0]).to.equal('playlist 2') | ||
689 | expect(names2[1]).to.equal('playlist 3 updated') | ||
690 | |||
691 | await removeVideoFromPlaylist({ url: server.url, token: server.accessToken, playlistId: playlistServer2Id2, videoId }) | ||
692 | |||
693 | const names3 = await getPlaylistNames() | ||
694 | expect(names3[0]).to.equal('playlist 3 updated') | ||
695 | expect(names3[1]).to.equal('playlist 2') | ||
696 | }) | ||
697 | |||
667 | it('Should delete some elements', async function () { | 698 | it('Should delete some elements', async function () { |
668 | this.timeout(30000) | 699 | this.timeout(30000) |
669 | 700 | ||