]> 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 ff8a43366f39819849990104e99f4742b35d3246..35e722408a036935f56d83164126fe85a12bffdc 100644 (file)
@@ -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)
+  }
 }
 
 // ---------------------------------------------------------------------------