aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-index.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/search/search-index.ts
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/search/search-index.ts')
-rw-r--r--server/tests/api/search/search-index.ts55
1 files changed, 34 insertions, 21 deletions
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index b2c0857a7..e4c5f5796 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -9,7 +9,6 @@ import {
9 SearchCommand, 9 SearchCommand,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 updateCustomSubConfig,
13 uploadVideo 12 uploadVideo
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' 14import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
@@ -39,12 +38,14 @@ describe('Test videos search', function () {
39 it('Should make a local videos search by default', async function () { 38 it('Should make a local videos search by default', async function () {
40 this.timeout(10000) 39 this.timeout(10000)
41 40
42 await updateCustomSubConfig(server.url, server.accessToken, { 41 await server.configCommand.updateCustomSubConfig({
43 search: { 42 newConfig: {
44 searchIndex: { 43 search: {
45 enabled: true, 44 searchIndex: {
46 isDefaultSearch: false, 45 enabled: true,
47 disableLocalSearch: false 46 isDefaultSearch: false,
47 disableLocalSearch: false
48 }
48 } 49 }
49 } 50 }
50 }) 51 })
@@ -64,12 +65,14 @@ describe('Test videos search', function () {
64 }) 65 })
65 66
66 it('Should make an index videos search by default', async function () { 67 it('Should make an index videos search by default', async function () {
67 await updateCustomSubConfig(server.url, server.accessToken, { 68 await server.configCommand.updateCustomSubConfig({
68 search: { 69 newConfig: {
69 searchIndex: { 70 search: {
70 enabled: true, 71 searchIndex: {
71 isDefaultSearch: true, 72 enabled: true,
72 disableLocalSearch: false 73 isDefaultSearch: true,
74 disableLocalSearch: false
75 }
73 } 76 }
74 } 77 }
75 }) 78 })
@@ -84,12 +87,14 @@ describe('Test videos search', function () {
84 }) 87 })
85 88
86 it('Should make an index videos search if local search is disabled', async function () { 89 it('Should make an index videos search if local search is disabled', async function () {
87 await updateCustomSubConfig(server.url, server.accessToken, { 90 await server.configCommand.updateCustomSubConfig({
88 search: { 91 newConfig: {
89 searchIndex: { 92 search: {
90 enabled: true, 93 searchIndex: {
91 isDefaultSearch: false, 94 enabled: true,
92 disableLocalSearch: true 95 isDefaultSearch: false,
96 disableLocalSearch: true
97 }
93 } 98 }
94 } 99 }
95 }) 100 })
@@ -216,7 +221,11 @@ describe('Test videos search', function () {
216 let nsfwUUID: string 221 let nsfwUUID: string
217 222
218 { 223 {
219 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) 224 await server.configCommand.updateCustomSubConfig({
225 newConfig: {
226 instance: { defaultNSFWPolicy: 'display' }
227 }
228 })
220 229
221 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 230 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' })
222 expect(body.data).to.have.length.greaterThan(0) 231 expect(body.data).to.have.length.greaterThan(0)
@@ -228,7 +237,11 @@ describe('Test videos search', function () {
228 } 237 }
229 238
230 { 239 {
231 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) 240 await server.configCommand.updateCustomSubConfig({
241 newConfig: {
242 instance: { defaultNSFWPolicy: 'do_not_list' }
243 }
244 })
232 245
233 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 246 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' })
234 247