aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/server-commands/videos/captions.ts
blob: 35e722408a036935f56d83164126fe85a12bffdc (plain) (tree)
1
2
3
4
5
6
7
8
9
                             
                               
                                               
 
                                                                                            



                                  




                                       






                                                                              
import { expect } from 'chai'
import request from 'supertest'
import { HttpStatusCode } from '@shared/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
}