]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/captions.ts
Rewrite youtube-dl import
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / captions.ts
index fc44cd250756717fb49ad61777f0a8edd3b19cec..35e722408a036935f56d83164126fe85a12bffdc 100644 (file)
@@ -2,12 +2,16 @@ import { expect } from 'chai'
 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)
+  }
 }
 
 // ---------------------------------------------------------------------------