aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tests/api/videos/video-imports.ts44
1 files changed, 43 insertions, 1 deletions
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index a67e528c6..1e97cc6ca 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { VideoDetails, VideoImport, VideoPrivacy } from '../../../../shared/models/videos' 5import { VideoDetails, VideoImport, VideoPrivacy, VideoCaption } from '../../../../shared/models/videos'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
@@ -11,6 +11,8 @@ import {
11 getMyVideos, 11 getMyVideos,
12 getVideo, 12 getVideo,
13 getVideosList, 13 getVideosList,
14 listVideoCaptions,
15 testCaptionFile,
14 immutableAssign, 16 immutableAssign,
15 ServerInfo, 17 ServerInfo,
16 setAccessTokensToServers 18 setAccessTokensToServers
@@ -110,6 +112,46 @@ describe('Test video imports', function () {
110 const attributes = immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() }) 112 const attributes = immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() })
111 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) 113 const res = await importVideo(servers[0].url, servers[0].accessToken, attributes)
112 expect(res.body.video.name).to.equal('small video - youtube') 114 expect(res.body.video.name).to.equal('small video - youtube')
115
116 const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id)
117 const videoCaptions: VideoCaption[] = resCaptions.body
118 expect(videoCaptions).to.have.lengthOf(2)
119
120 const enCaption = videoCaptions.filter(caption => caption.language.label === 'en')[0]
121 expect(enCaption).to.not(undefined)
122 expect(enCaption.language.label).to.equal('en')
123 expect(enCaption.captionPath).to.equal(`/static/video-captions/${res.body.video.uuid}-en.vtt`)
124 await testCaptionFile(servers[0].url, enCaption.captionPath, `WEBVTT
125
126 1
127 00:00:01.600 --> 00:00:04.200
128 English (US)
129
130 2
131 00:00:05.900 --> 00:00:07.999
132 This is a subtitle in American English
133
134 3
135 00:00:10.000 --> 00:00:14.000
136 Adding subtitles is very easy to do`)
137
138 const frCaption = videoCaptions.filter(caption => caption.language.label === 'fr')[0]
139 expect(frCaption).to.not(undefined)
140 expect(frCaption.language.label).to.equal('fr')
141 expect(frCaption.captionPath).to.equal(`/static/video-captions/${res.body.video.uuid}-en.vtt`)
142 await testCaptionFile(servers[0].url, frCaption.captionPath, `WEBVTT
143
144 1
145 00:00:01,600 --> 00:00:04.200
146 Français (FR)
147
148 2
149 00:00:05,900 --> 00:00:07.999
150 C'est un sous-titre français
151
152 3
153 00:00:10,000 --> 00:00:14.000
154 Ajouter un sous-titre est vraiment facile`)
113 } 155 }
114 156
115 { 157 {