import request from 'supertest'
import { HttpStatusCode } from '@shared/models'
-async function testCaptionFile (url: string, captionPath: string, containsString: string) {
+async function testCaptionFile (url: string, captionPath: string, toTest: RegExp | string) {
const res = await request(url)
.get(captionPath)
.expect(HttpStatusCode.OK_200)
- expect(res.text).to.contain(containsString)
+ if (toTest instanceof RegExp) {
+ expect(res.text).to.match(toTest)
+ } else {
+ expect(res.text).to.contain(toTest)
+ }
}
// ---------------------------------------------------------------------------