]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/captions.ts
Add ability to remove hls/webtorrent files
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / captions.ts
index 2246bd1335fb0dca86911e51f7a60abaac14e79f..35e722408a036935f56d83164126fe85a12bffdc 100644 (file)
@@ -1,13 +1,17 @@
 import { expect } from 'chai'
-import * as request from 'supertest'
-import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
+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)
+  }
 }
 
 // ---------------------------------------------------------------------------