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