aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/video-abuses.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/video-abuses.ts')
-rw-r--r--server/tests/api/check-params/video-abuses.ts30
1 files changed, 27 insertions, 3 deletions
diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts
index a3fe00ffb..557bf20eb 100644
--- a/server/tests/api/check-params/video-abuses.ts
+++ b/server/tests/api/check-params/video-abuses.ts
@@ -20,7 +20,7 @@ import {
20 checkBadSortPagination, 20 checkBadSortPagination,
21 checkBadStartPagination 21 checkBadStartPagination
22} from '../../../../shared/extra-utils/requests/check-api-params' 22} from '../../../../shared/extra-utils/requests/check-api-params'
23import { VideoAbuseState } from '../../../../shared/models/videos' 23import { VideoAbuseState, VideoAbuseCreate } from '../../../../shared/models/videos'
24 24
25describe('Test video abuses API validators', function () { 25describe('Test video abuses API validators', function () {
26 let server: ServerInfo 26 let server: ServerInfo
@@ -132,12 +132,36 @@ describe('Test video abuses API validators', function () {
132 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 132 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
133 }) 133 })
134 134
135 it('Should succeed with the correct parameters', async function () { 135 it('Should succeed with the correct parameters (basic)', async function () {
136 const fields = { reason: 'super reason' } 136 const fields = { reason: 'my super reason' }
137 137
138 const res = await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 200 }) 138 const res = await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 200 })
139 videoAbuseId = res.body.videoAbuse.id 139 videoAbuseId = res.body.videoAbuse.id
140 }) 140 })
141
142 it('Should fail with a wrong predefined reason', async function () {
143 const fields = { reason: 'my super reason', predefinedReasons: [ 'wrongPredefinedReason' ] }
144
145 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
146 })
147
148 it('Should fail with negative timestamps', async function () {
149 const fields = { reason: 'my super reason', startAt: -1 }
150
151 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
152 })
153
154 it('Should fail mith misordered startAt/endAt', async function () {
155 const fields = { reason: 'my super reason', startAt: 5, endAt: 1 }
156
157 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
158 })
159
160 it('Should succeed with the corret parameters (advanced)', async function () {
161 const fields: VideoAbuseCreate = { reason: 'my super reason', predefinedReasons: [ 'serverRules' ], startAt: 1, endAt: 5 }
162
163 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 200 })
164 })
141 }) 165 })
142 166
143 describe('When updating a video abuse', function () { 167 describe('When updating a video abuse', function () {