X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fvideos%2Fcaptions.ts;h=35e722408a036935f56d83164126fe85a12bffdc;hb=62549e6c9818f422698f030e0b242609115493ed;hp=ff8a43366f39819849990104e99f4742b35d3246;hpb=9e8789497377cac5554a622da605f5b89587aa9c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/videos/captions.ts b/shared/extra-utils/videos/captions.ts index ff8a43366..35e722408 100644 --- a/shared/extra-utils/videos/captions.ts +++ b/shared/extra-utils/videos/captions.ts @@ -1,13 +1,17 @@ import { expect } from 'chai' -import * as request from 'supertest' +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) + } } // ---------------------------------------------------------------------------