aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-nsfw.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/video-nsfw.ts')
-rw-r--r--server/tests/api/videos/video-nsfw.ts30
1 files changed, 25 insertions, 5 deletions
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 6af0ca8af..38bdaa54e 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -30,7 +30,7 @@ describe('Test video NSFW policy', function () {
30 let userAccessToken: string 30 let userAccessToken: string
31 let customConfig: CustomConfig 31 let customConfig: CustomConfig
32 32
33 function getVideosFunctions (token?: string) { 33 function getVideosFunctions (token?: string, query = {}) {
34 return getMyUserInformation(server.url, server.accessToken) 34 return getMyUserInformation(server.url, server.accessToken)
35 .then(res => { 35 .then(res => {
36 const user: User = res.body 36 const user: User = res.body
@@ -39,10 +39,10 @@ describe('Test video NSFW policy', function () {
39 39
40 if (token) { 40 if (token) {
41 return Promise.all([ 41 return Promise.all([
42 getVideosListWithToken(server.url, token), 42 getVideosListWithToken(server.url, token, query),
43 searchVideoWithToken(server.url, 'n', token), 43 searchVideoWithToken(server.url, 'n', token, query),
44 getAccountVideos(server.url, token, accountName, 0, 5), 44 getAccountVideos(server.url, token, accountName, 0, 5, undefined, query),
45 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5) 45 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5, undefined, query)
46 ]) 46 ])
47 } 47 }
48 48
@@ -200,6 +200,26 @@ describe('Test video NSFW policy', function () {
200 expect(videos[ 0 ].name).to.equal('normal') 200 expect(videos[ 0 ].name).to.equal('normal')
201 expect(videos[ 1 ].name).to.equal('nsfw') 201 expect(videos[ 1 ].name).to.equal('nsfw')
202 }) 202 })
203
204 it('Should display NSFW videos when the nsfw param === true', async function () {
205 for (const res of await getVideosFunctions(server.accessToken, { nsfw: true })) {
206 expect(res.body.total).to.equal(1)
207
208 const videos = res.body.data
209 expect(videos).to.have.lengthOf(1)
210 expect(videos[ 0 ].name).to.equal('nsfw')
211 }
212 })
213
214 it('Should hide NSFW videos when the nsfw param === true', async function () {
215 for (const res of await getVideosFunctions(server.accessToken, { nsfw: false })) {
216 expect(res.body.total).to.equal(1)
217
218 const videos = res.body.data
219 expect(videos).to.have.lengthOf(1)
220 expect(videos[ 0 ].name).to.equal('normal')
221 }
222 })
203 }) 223 })
204 224
205 after(async function () { 225 after(async function () {