2021-07-08 05:49:38 -04:00
|
|
|
import { expect } from 'chai'
|
2021-08-27 08:32:44 -04:00
|
|
|
import request from 'supertest'
|
2021-07-16 04:42:24 -04:00
|
|
|
import { HttpStatusCode } from '@shared/models'
|
2021-07-08 05:49:38 -04:00
|
|
|
|
2021-10-21 10:28:39 -04:00
|
|
|
async function testCaptionFile (url: string, captionPath: string, toTest: RegExp | string) {
|
2021-07-08 05:49:38 -04:00
|
|
|
const res = await request(url)
|
|
|
|
.get(captionPath)
|
|
|
|
.expect(HttpStatusCode.OK_200)
|
|
|
|
|
2021-10-21 10:28:39 -04:00
|
|
|
if (toTest instanceof RegExp) {
|
|
|
|
expect(res.text).to.match(toTest)
|
|
|
|
} else {
|
|
|
|
expect(res.text).to.contain(toTest)
|
|
|
|
}
|
2021-07-08 05:49:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
testCaptionFile
|
|
|
|
}
|