From 37a44fc915eef2140e22ceb96aba6b6eb2509007 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 17 Jun 2021 16:02:38 +0200 Subject: Add ability to search playlists --- server/tests/plugins/filter-hooks.ts | 24 +++++++++++++++++++++++- server/tests/plugins/translations.ts | 8 ++++---- 2 files changed, 27 insertions(+), 5 deletions(-) (limited to 'server/tests/plugins') diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index a947283c2..644b41dea 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts @@ -8,6 +8,7 @@ import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-code import { addVideoCommentReply, addVideoCommentThread, + advancedVideoPlaylistSearch, advancedVideosSearch, createLive, createVideoPlaylist, @@ -71,7 +72,7 @@ describe('Test plugin filter hooks', function () { await installPlugin({ url: servers[0].url, accessToken: servers[0].accessToken, - path: getPluginTestPath('-two') + path: getPluginTestPath('-filter-translations') }) for (let i = 0; i < 10; i++) { @@ -525,6 +526,27 @@ describe('Test plugin filter hooks', function () { await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.params', 1) await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.result', 1) }) + + it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { + await advancedVideoPlaylistSearch(servers[0].url, { + search: 'Sun Jian' + }) + + await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) + await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.result', 1) + }) + + it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { + await advancedVideoPlaylistSearch(servers[0].url, { + search: 'Sun Jian', + searchTarget: 'search-index' + }) + + await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) + await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.result', 1) + await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.index.list.params', 1) + await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.index.list.result', 1) + }) }) after(async function () { diff --git a/server/tests/plugins/translations.ts b/server/tests/plugins/translations.ts index 8dc2043b8..9fd2ba1c5 100644 --- a/server/tests/plugins/translations.ts +++ b/server/tests/plugins/translations.ts @@ -31,7 +31,7 @@ describe('Test plugin translations', function () { await installPlugin({ url: server.url, accessToken: server.accessToken, - path: getPluginTestPath('-two') + path: getPluginTestPath('-filter-translations') }) }) @@ -48,7 +48,7 @@ describe('Test plugin translations', function () { 'peertube-plugin-test': { Hi: 'Coucou' }, - 'peertube-plugin-test-two': { + 'peertube-plugin-test-filter-translations': { 'Hello world': 'Bonjour le monde' } }) @@ -58,14 +58,14 @@ describe('Test plugin translations', function () { const res = await getPluginTranslations({ url: server.url, locale: 'it-IT' }) expect(res.body).to.deep.equal({ - 'peertube-plugin-test-two': { + 'peertube-plugin-test-filter-translations': { 'Hello world': 'Ciao, mondo!' } }) }) it('Should remove the plugin and remove the locales', async function () { - await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-test-two' }) + await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-test-filter-translations' }) { const res = await getPluginTranslations({ url: server.url, locale: 'fr-FR' }) -- cgit v1.2.3