aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/search')
-rw-r--r--server/tests/api/search/search-index.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index 2354aaa8b..40065d162 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -209,6 +209,37 @@ describe('Test videos search', function () {
209 expect(res.body.total).to.be.greaterThan(5) 209 expect(res.body.total).to.be.greaterThan(5)
210 expect(res.body.data).to.have.lengthOf(5) 210 expect(res.body.data).to.have.lengthOf(5)
211 }) 211 })
212
213 it('Should use the nsfw instance policy as default', async function () {
214 let nsfwUUID: string
215
216 {
217 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } })
218
219 const res = await searchVideo(server.url, 'NSFW search index')
220 const video = res.body.data[0] as Video
221
222 expect(res.body.data).to.have.length.greaterThan(0)
223 expect(video.nsfw).to.be.true
224
225 nsfwUUID = video.uuid
226 }
227
228 {
229 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } })
230
231 const res = await searchVideo(server.url, 'NSFW search index')
232
233 try {
234 expect(res.body.data).to.have.lengthOf(0)
235 } catch (err) {
236 //
237 const video = res.body.data[0] as Video
238
239 expect(video.uuid).not.equal(nsfwUUID)
240 }
241 }
242 })
212 }) 243 })
213 244
214 describe('Channels search', async function () { 245 describe('Channels search', async function () {