From fbd67e7f386504e50f2504cb6386700a58906f16 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Jul 2021 16:40:21 +0200 Subject: Add ability to search by uuids/actor names --- server/tests/api/search/search-playlists.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'server/tests/api/search/search-playlists.ts') diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts index e7e53ff41..85be1eb59 100644 --- a/server/tests/api/search/search-playlists.ts +++ b/server/tests/api/search/search-playlists.ts @@ -19,12 +19,18 @@ describe('Test playlists search', function () { let server: PeerTubeServer let remoteServer: PeerTubeServer let command: SearchCommand + let playlistUUID: string + let playlistShortUUID: string before(async function () { this.timeout(120000) - server = await createSingleServer(1) - remoteServer = await createSingleServer(2, { transcoding: { enabled: false } }) + const servers = await Promise.all([ + createSingleServer(1), + createSingleServer(2, { transcoding: { enabled: false } }) + ]) + server = servers[0] + remoteServer = servers[1] await setAccessTokensToServers([ remoteServer, server ]) await setDefaultVideoChannel([ remoteServer, server ]) @@ -38,6 +44,8 @@ describe('Test playlists search', function () { videoChannelId: server.store.channel.id } const created = await server.playlists.create({ attributes }) + playlistUUID = created.uuid + playlistShortUUID = created.shortUUID await server.playlists.addElement({ playlistId: created.id, attributes: { videoId } }) } @@ -136,6 +144,22 @@ describe('Test playlists search', function () { } }) + it('Should filter by UUIDs', async function () { + for (const uuid of [ playlistUUID, playlistShortUUID ]) { + const body = await command.advancedPlaylistSearch({ search: { uuids: [ uuid ] } }) + + expect(body.total).to.equal(1) + expect(body.data[0].displayName).to.equal('Dr. Kenzo Tenma hospital videos') + } + + { + const body = await command.advancedPlaylistSearch({ search: { uuids: [ 'dfd70b83-639f-4980-94af-304a56ab4b35' ] } }) + + expect(body.total).to.equal(0) + expect(body.data).to.have.lengthOf(0) + } + }) + it('Should not display playlists without videos', async function () { const search = { search: 'Lunge', -- cgit v1.2.3