diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-21 16:13:20 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-21 16:13:20 +0200 |
commit | d1aed103539e2e53418a44716f8f2b1603cd339f (patch) | |
tree | a4b43d0f852f362eead0224fa9d992a908c04478 /server/tests | |
parent | 64f9b91de99eb04cad12ec7370eddc30f6fda1e5 (diff) | |
download | PeerTube-d1aed103539e2e53418a44716f8f2b1603cd339f.tar.gz PeerTube-d1aed103539e2e53418a44716f8f2b1603cd339f.tar.zst PeerTube-d1aed103539e2e53418a44716f8f2b1603cd339f.zip |
Add overviews filter hook tests
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/fixtures/peertube-plugin-test/main.js | 9 | ||||
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js index f8e6f0b98..db405ff31 100644 --- a/server/tests/fixtures/peertube-plugin-test/main.js +++ b/server/tests/fixtures/peertube-plugin-test/main.js | |||
@@ -234,7 +234,7 @@ async function register ({ registerHook, registerSetting, settingsManager, stora | |||
234 | }) | 234 | }) |
235 | 235 | ||
236 | { | 236 | { |
237 | const searchHooks = [ | 237 | const filterHooks = [ |
238 | 'filter:api.search.videos.local.list.params', | 238 | 'filter:api.search.videos.local.list.params', |
239 | 'filter:api.search.videos.local.list.result', | 239 | 'filter:api.search.videos.local.list.result', |
240 | 'filter:api.search.videos.index.list.params', | 240 | 'filter:api.search.videos.index.list.params', |
@@ -246,10 +246,13 @@ async function register ({ registerHook, registerSetting, settingsManager, stora | |||
246 | 'filter:api.search.video-playlists.local.list.params', | 246 | 'filter:api.search.video-playlists.local.list.params', |
247 | 'filter:api.search.video-playlists.local.list.result', | 247 | 'filter:api.search.video-playlists.local.list.result', |
248 | 'filter:api.search.video-playlists.index.list.params', | 248 | 'filter:api.search.video-playlists.index.list.params', |
249 | 'filter:api.search.video-playlists.index.list.result' | 249 | 'filter:api.search.video-playlists.index.list.result', |
250 | |||
251 | 'filter:api.overviews.videos.list.params', | ||
252 | 'filter:api.overviews.videos.list.result' | ||
250 | ] | 253 | ] |
251 | 254 | ||
252 | for (const h of searchHooks) { | 255 | for (const h of filterHooks) { |
253 | registerHook({ | 256 | registerHook({ |
254 | target: h, | 257 | target: h, |
255 | handler: (obj) => { | 258 | handler: (obj) => { |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index c00ac8f91..02915f08c 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -255,6 +255,14 @@ describe('Test plugin filter hooks', function () { | |||
255 | expect(thread.comment.text.endsWith(' <3')).to.be.true | 255 | expect(thread.comment.text.endsWith(' <3')).to.be.true |
256 | }) | 256 | }) |
257 | 257 | ||
258 | it('Should run filter:api.overviews.videos.list.{params,result}', async function () { | ||
259 | await servers[0].overviews.getVideos({ page: 1 }) | ||
260 | |||
261 | // 3 because we get 3 samples per page | ||
262 | await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.params', 3) | ||
263 | await servers[0].servers.waitUntilLog('Run hook filter:api.overviews.videos.list.result', 3) | ||
264 | }) | ||
265 | |||
258 | describe('Should run filter:video.auto-blacklist.result', function () { | 266 | describe('Should run filter:video.auto-blacklist.result', function () { |
259 | 267 | ||
260 | async function checkIsBlacklisted (id: number | string, value: boolean) { | 268 | async function checkIsBlacklisted (id: number | string, value: boolean) { |