X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fsearch%2Fsearch-playlists.ts;h=1e9c8d4bb1ba46721d9f474097c45447b6a1d0f0;hb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;hp=c3b318f5b480f8bab68452a7a4bf91551a64b0c5;hpb=fa47956ecf51a6d5d10aeb25d2e4db3da90c7d58;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts index c3b318f5b..1e9c8d4bb 100644 --- a/server/tests/api/search/search-playlists.ts +++ b/server/tests/api/search/search-playlists.ts @@ -10,7 +10,7 @@ import { SearchCommand, setAccessTokensToServers, setDefaultVideoChannel -} from '@shared/extra-utils' +} from '@shared/server-commands' import { VideoPlaylistPrivacy } from '@shared/models' const expect = chai.expect @@ -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(30000) + 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', @@ -148,6 +172,6 @@ describe('Test playlists search', function () { }) after(async function () { - await cleanupTests([ server ]) + await cleanupTests([ server, remoteServer ]) }) })