diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/videos/video-captions.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-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.ts | 9 |
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 | |||
2 | import * as request from 'supertest' | 2 | import * as request from 'supertest' |
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import { buildAbsoluteFixturePath } from '../miscs/miscs' | 4 | import { buildAbsoluteFixturePath } from '../miscs/miscs' |
5 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
5 | 6 | ||
6 | const expect = chai.expect | 7 | const 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 | ||
56 | async function testCaptionFile (url: string, captionPath: string, containsString: string) { | 57 | async 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 | } |