aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/video-captions.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-07 14:32:36 +0100
committerGitHub <noreply@github.com>2020-12-07 14:32:36 +0100
commit2d53be0267acc49cda46707b885096193a1f4e9c (patch)
tree887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/videos/video-captions.ts
parentadc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff)
downloadPeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'shared/extra-utils/videos/video-captions.ts')
-rw-r--r--shared/extra-utils/videos/video-captions.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/shared/extra-utils/videos/video-captions.ts b/shared/extra-utils/videos/video-captions.ts
index 5bd533bba..62eec7b90 100644
--- a/shared/extra-utils/videos/video-captions.ts
+++ b/shared/extra-utils/videos/video-captions.ts
@@ -2,6 +2,7 @@ import { makeDeleteRequest, makeGetRequest, makeUploadRequest } from '../request
2import * as request from 'supertest' 2import * as request from 'supertest'
3import * as chai from 'chai' 3import * as chai from 'chai'
4import { buildAbsoluteFixturePath } from '../miscs/miscs' 4import { buildAbsoluteFixturePath } from '../miscs/miscs'
5import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
5 6
6const expect = chai.expect 7const expect = chai.expect
7 8
@@ -28,7 +29,7 @@ function createVideoCaption (args: {
28 attaches: { 29 attaches: {
29 captionfile: captionfileAttach 30 captionfile: captionfileAttach
30 }, 31 },
31 statusCodeExpected: args.statusCodeExpected || 204 32 statusCodeExpected: args.statusCodeExpected || HttpStatusCode.NO_CONTENT_204
32 }) 33 })
33} 34}
34 35
@@ -38,7 +39,7 @@ function listVideoCaptions (url: string, videoId: string | number) {
38 return makeGetRequest({ 39 return makeGetRequest({
39 url, 40 url,
40 path, 41 path,
41 statusCodeExpected: 200 42 statusCodeExpected: HttpStatusCode.OK_200
42 }) 43 })
43} 44}
44 45
@@ -49,14 +50,14 @@ function deleteVideoCaption (url: string, token: string, videoId: string | numbe
49 url, 50 url,
50 token, 51 token,
51 path, 52 path,
52 statusCodeExpected: 204 53 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
53 }) 54 })
54} 55}
55 56
56async function testCaptionFile (url: string, captionPath: string, containsString: string) { 57async function testCaptionFile (url: string, captionPath: string, containsString: string) {
57 const res = await request(url) 58 const res = await request(url)
58 .get(captionPath) 59 .get(captionPath)
59 .expect(200) 60 .expect(HttpStatusCode.OK_200)
60 61
61 expect(res.text).to.contain(containsString) 62 expect(res.text).to.contain(containsString)
62} 63}