diff options
Diffstat (limited to 'server/tests/api/search/search-playlists.ts')
-rw-r--r-- | server/tests/api/search/search-playlists.ts | 28 |
1 files changed, 26 insertions, 2 deletions
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 () { | |||
19 | let server: PeerTubeServer | 19 | let server: PeerTubeServer |
20 | let remoteServer: PeerTubeServer | 20 | let remoteServer: PeerTubeServer |
21 | let command: SearchCommand | 21 | let command: SearchCommand |
22 | let playlistUUID: string | ||
23 | let playlistShortUUID: string | ||
22 | 24 | ||
23 | before(async function () { | 25 | before(async function () { |
24 | this.timeout(120000) | 26 | this.timeout(120000) |
25 | 27 | ||
26 | server = await createSingleServer(1) | 28 | const servers = await Promise.all([ |
27 | remoteServer = await createSingleServer(2, { transcoding: { enabled: false } }) | 29 | createSingleServer(1), |
30 | createSingleServer(2, { transcoding: { enabled: false } }) | ||
31 | ]) | ||
32 | server = servers[0] | ||
33 | remoteServer = servers[1] | ||
28 | 34 | ||
29 | await setAccessTokensToServers([ remoteServer, server ]) | 35 | await setAccessTokensToServers([ remoteServer, server ]) |
30 | await setDefaultVideoChannel([ remoteServer, server ]) | 36 | await setDefaultVideoChannel([ remoteServer, server ]) |
@@ -38,6 +44,8 @@ describe('Test playlists search', function () { | |||
38 | videoChannelId: server.store.channel.id | 44 | videoChannelId: server.store.channel.id |
39 | } | 45 | } |
40 | const created = await server.playlists.create({ attributes }) | 46 | const created = await server.playlists.create({ attributes }) |
47 | playlistUUID = created.uuid | ||
48 | playlistShortUUID = created.shortUUID | ||
41 | 49 | ||
42 | await server.playlists.addElement({ playlistId: created.id, attributes: { videoId } }) | 50 | await server.playlists.addElement({ playlistId: created.id, attributes: { videoId } }) |
43 | } | 51 | } |
@@ -136,6 +144,22 @@ describe('Test playlists search', function () { | |||
136 | } | 144 | } |
137 | }) | 145 | }) |
138 | 146 | ||
147 | it('Should filter by UUIDs', async function () { | ||
148 | for (const uuid of [ playlistUUID, playlistShortUUID ]) { | ||
149 | const body = await command.advancedPlaylistSearch({ search: { uuids: [ uuid ] } }) | ||
150 | |||
151 | expect(body.total).to.equal(1) | ||
152 | expect(body.data[0].displayName).to.equal('Dr. Kenzo Tenma hospital videos') | ||
153 | } | ||
154 | |||
155 | { | ||
156 | const body = await command.advancedPlaylistSearch({ search: { uuids: [ 'dfd70b83-639f-4980-94af-304a56ab4b35' ] } }) | ||
157 | |||
158 | expect(body.total).to.equal(0) | ||
159 | expect(body.data).to.have.lengthOf(0) | ||
160 | } | ||
161 | }) | ||
162 | |||
139 | it('Should not display playlists without videos', async function () { | 163 | it('Should not display playlists without videos', async function () { |
140 | const search = { | 164 | const search = { |
141 | search: 'Lunge', | 165 | search: 'Lunge', |