aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-captions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/video-captions.ts')
-rw-r--r--server/tests/api/videos/video-captions.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index 5b36dc021..14ecedfa6 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -24,6 +24,8 @@ import { VideoCaption } from '../../../../shared/models/videos/caption/video-cap
24const expect = chai.expect 24const expect = chai.expect
25 25
26describe('Test video captions', function () { 26describe('Test video captions', function () {
27 const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
28
27 let servers: ServerInfo[] 29 let servers: ServerInfo[]
28 let videoUUID: string 30 let videoUUID: string
29 31
@@ -83,13 +85,13 @@ describe('Test video captions', function () {
83 const caption1: VideoCaption = res.body.data[0] 85 const caption1: VideoCaption = res.body.data[0]
84 expect(caption1.language.id).to.equal('ar') 86 expect(caption1.language.id).to.equal('ar')
85 expect(caption1.language.label).to.equal('Arabic') 87 expect(caption1.language.label).to.equal('Arabic')
86 expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt') 88 expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$'))
87 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.') 89 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.')
88 90
89 const caption2: VideoCaption = res.body.data[1] 91 const caption2: VideoCaption = res.body.data[1]
90 expect(caption2.language.id).to.equal('zh') 92 expect(caption2.language.id).to.equal('zh')
91 expect(caption2.language.label).to.equal('Chinese') 93 expect(caption2.language.label).to.equal('Chinese')
92 expect(caption2.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-zh.vtt') 94 expect(caption2.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-zh.vtt$'))
93 await testCaptionFile(server.url, caption2.captionPath, 'Subtitle good 2.') 95 await testCaptionFile(server.url, caption2.captionPath, 'Subtitle good 2.')
94 } 96 }
95 }) 97 })
@@ -117,7 +119,7 @@ describe('Test video captions', function () {
117 const caption1: VideoCaption = res.body.data[0] 119 const caption1: VideoCaption = res.body.data[0]
118 expect(caption1.language.id).to.equal('ar') 120 expect(caption1.language.id).to.equal('ar')
119 expect(caption1.language.label).to.equal('Arabic') 121 expect(caption1.language.label).to.equal('Arabic')
120 expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt') 122 expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$'))
121 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 2.') 123 await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 2.')
122 } 124 }
123 }) 125 })
@@ -148,7 +150,7 @@ describe('Test video captions', function () {
148 const caption1: VideoCaption = res.body.data[0] 150 const caption1: VideoCaption = res.body.data[0]
149 expect(caption1.language.id).to.equal('ar') 151 expect(caption1.language.id).to.equal('ar')
150 expect(caption1.language.label).to.equal('Arabic') 152 expect(caption1.language.label).to.equal('Arabic')
151 expect(caption1.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-ar.vtt') 153 expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$'))
152 154
153 const expected = 'WEBVTT FILE\r\n' + 155 const expected = 'WEBVTT FILE\r\n' +
154 '\r\n' + 156 '\r\n' +
@@ -185,7 +187,7 @@ describe('Test video captions', function () {
185 187
186 expect(caption.language.id).to.equal('zh') 188 expect(caption.language.id).to.equal('zh')
187 expect(caption.language.label).to.equal('Chinese') 189 expect(caption.language.label).to.equal('Chinese')
188 expect(caption.captionPath).to.equal('/lazy-static/video-captions/' + videoUUID + '-zh.vtt') 190 expect(caption.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-zh.vtt$'))
189 await testCaptionFile(server.url, caption.captionPath, 'Subtitle good 2.') 191 await testCaptionFile(server.url, caption.captionPath, 'Subtitle good 2.')
190 } 192 }
191 }) 193 })