X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fsearch%2Fsearch-index.ts;h=40065d162daf9342d54ec133f8c486a2bf15447f;hb=f2eb23cd87cf32b8fe545178143b5f49e06a58da;hp=2354aaa8b1c03df6c71ccc598974a800dfd80dd4;hpb=3521ab8fc01da85fa804439ca6e297e6fb364c58;p=github%2FChocobozzz%2FPeerTube.git 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 () { expect(res.body.total).to.be.greaterThan(5) expect(res.body.data).to.have.lengthOf(5) }) + + it('Should use the nsfw instance policy as default', async function () { + let nsfwUUID: string + + { + await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) + + const res = await searchVideo(server.url, 'NSFW search index') + const video = res.body.data[0] as Video + + expect(res.body.data).to.have.length.greaterThan(0) + expect(video.nsfw).to.be.true + + nsfwUUID = video.uuid + } + + { + await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) + + const res = await searchVideo(server.url, 'NSFW search index') + + try { + expect(res.body.data).to.have.lengthOf(0) + } catch (err) { + // + const video = res.body.data[0] as Video + + expect(video.uuid).not.equal(nsfwUUID) + } + } + }) }) describe('Channels search', async function () {