]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/server-commands/videos/captions.ts
shared/ typescript types dir server-commands
[github/Chocobozzz/PeerTube.git] / shared / server-commands / videos / captions.ts
CommitLineData
a2470c9f 1import { expect } from 'chai'
41fb13c3 2import request from 'supertest'
c0e8b12e 3import { HttpStatusCode } from '@shared/models'
a2470c9f 4
62549e6c 5async function testCaptionFile (url: string, captionPath: string, toTest: RegExp | string) {
a2470c9f
C
6 const res = await request(url)
7 .get(captionPath)
8 .expect(HttpStatusCode.OK_200)
9
62549e6c
C
10 if (toTest instanceof RegExp) {
11 expect(res.text).to.match(toTest)
12 } else {
13 expect(res.text).to.contain(toTest)
14 }
a2470c9f
C
15}
16
17// ---------------------------------------------------------------------------
18
19export {
20 testCaptionFile
21}