aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/filter-hooks.ts62
1 files changed, 61 insertions, 1 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index be47b20ba..6f7fec767 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -7,6 +7,7 @@ import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-code
7import { 7import {
8 addVideoCommentReply, 8 addVideoCommentReply,
9 addVideoCommentThread, 9 addVideoCommentThread,
10 advancedVideosSearch,
10 createLive, 11 createLive,
11 createVideoPlaylist, 12 createVideoPlaylist,
12 doubleFollow, 13 doubleFollow,
@@ -25,6 +26,7 @@ import {
25 installPlugin, 26 installPlugin,
26 makeRawRequest, 27 makeRawRequest,
27 registerUser, 28 registerUser,
29 searchVideo,
28 setAccessTokensToServers, 30 setAccessTokensToServers,
29 setDefaultVideoChannel, 31 setDefaultVideoChannel,
30 updateCustomSubConfig, 32 updateCustomSubConfig,
@@ -33,7 +35,7 @@ import {
33 uploadVideoAndGetId, 35 uploadVideoAndGetId,
34 waitJobs 36 waitJobs
35} from '../../../shared/extra-utils' 37} from '../../../shared/extra-utils'
36import { cleanupTests, flushAndRunMultipleServers, ServerInfo } from '../../../shared/extra-utils/server/servers' 38import { cleanupTests, flushAndRunMultipleServers, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers'
37import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports' 39import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports'
38import { 40import {
39 VideoDetails, 41 VideoDetails,
@@ -44,6 +46,7 @@ import {
44 VideoPrivacy 46 VideoPrivacy
45} from '../../../shared/models/videos' 47} from '../../../shared/models/videos'
46import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' 48import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'
49import { advancedVideoChannelSearch } from '@shared/extra-utils/search/video-channels'
47 50
48const expect = chai.expect 51const expect = chai.expect
49 52
@@ -468,6 +471,63 @@ describe('Test plugin filter hooks', function () {
468 }) 471 })
469 }) 472 })
470 473
474 describe('Search filters', function () {
475
476 before(async function () {
477 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, {
478 search: {
479 searchIndex: {
480 enabled: true,
481 isDefaultSearch: false,
482 disableLocalSearch: false
483 }
484 }
485 })
486 })
487
488 it('Should run filter:api.search.videos.local.list.{params,result}', async function () {
489 await advancedVideosSearch(servers[0].url, {
490 search: 'Sun Quan'
491 })
492
493 await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1)
494 await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.result', 1)
495 })
496
497 it('Should run filter:api.search.videos.index.list.{params,result}', async function () {
498 await advancedVideosSearch(servers[0].url, {
499 search: 'Sun Quan',
500 searchTarget: 'search-index'
501 })
502
503 await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1)
504 await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.result', 1)
505 await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.index.list.params', 1)
506 await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.index.list.result', 1)
507 })
508
509 it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () {
510 await advancedVideoChannelSearch(servers[0].url, {
511 search: 'Sun Ce'
512 })
513
514 await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1)
515 await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.result', 1)
516 })
517
518 it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () {
519 await advancedVideoChannelSearch(servers[0].url, {
520 search: 'Sun Ce',
521 searchTarget: 'search-index'
522 })
523
524 await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1)
525 await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.result', 1)
526 await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.params', 1)
527 await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.result', 1)
528 })
529 })
530
471 after(async function () { 531 after(async function () {
472 await cleanupTests(servers) 532 await cleanupTests(servers)
473 }) 533 })