diff options
Diffstat (limited to 'shared/extra-utils/videos/captions.ts')
-rw-r--r-- | shared/extra-utils/videos/captions.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/shared/extra-utils/videos/captions.ts b/shared/extra-utils/videos/captions.ts index fc44cd250..35e722408 100644 --- a/shared/extra-utils/videos/captions.ts +++ b/shared/extra-utils/videos/captions.ts | |||
@@ -2,12 +2,16 @@ import { expect } from 'chai' | |||
2 | import request from 'supertest' | 2 | import request from 'supertest' |
3 | import { HttpStatusCode } from '@shared/models' | 3 | import { HttpStatusCode } from '@shared/models' |
4 | 4 | ||
5 | async function testCaptionFile (url: string, captionPath: string, containsString: string) { | 5 | async function testCaptionFile (url: string, captionPath: string, toTest: RegExp | string) { |
6 | const res = await request(url) | 6 | const res = await request(url) |
7 | .get(captionPath) | 7 | .get(captionPath) |
8 | .expect(HttpStatusCode.OK_200) | 8 | .expect(HttpStatusCode.OK_200) |
9 | 9 | ||
10 | expect(res.text).to.contain(containsString) | 10 | if (toTest instanceof RegExp) { |
11 | expect(res.text).to.match(toTest) | ||
12 | } else { | ||
13 | expect(res.text).to.contain(toTest) | ||
14 | } | ||
11 | } | 15 | } |
12 | 16 | ||
13 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |