aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/tests/src/shared/captions.ts
blob: 436cf8dccaf763abfdcf5d5be15f3f3e1b5a4134 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { expect } from 'chai'
import request from 'supertest'
import { HttpStatusCode } from '@peertube/peertube-models'

async function testCaptionFile (url: string, captionPath: string, toTest: RegExp | string) {
  const res = await request(url)
    .get(captionPath)
    .expect(HttpStatusCode.OK_200)

  if (toTest instanceof RegExp) {
    expect(res.text).to.match(toTest)
  } else {
    expect(res.text).to.contain(toTest)
  }
}

// ---------------------------------------------------------------------------

export {
  testCaptionFile
}