diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-15 14:15:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-04-15 14:15:44 +0200 |
commit | 652c64165b3d8d1c5d5fc646c29e5cd1c82a3330 (patch) | |
tree | 03958b1ca6ace8781e23c8b0210a42ae00828bf2 /server/tests | |
parent | ba6e9e8f1df29a7f355636d48c2a608bc4cb54ec (diff) | |
download | PeerTube-652c64165b3d8d1c5d5fc646c29e5cd1c82a3330.tar.gz PeerTube-652c64165b3d8d1c5d5fc646c29e5cd1c82a3330.tar.zst PeerTube-652c64165b3d8d1c5d5fc646c29e5cd1c82a3330.zip |
Fix import captions test
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/videos/video-imports.ts | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 1e97cc6ca..8e179b825 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts | |||
@@ -62,11 +62,14 @@ describe('Test video imports', function () { | |||
62 | 62 | ||
63 | expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') | 63 | expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') |
64 | expect(videoMagnet.name).to.contain('super peertube2 video') | 64 | expect(videoMagnet.name).to.contain('super peertube2 video') |
65 | |||
66 | const resCaptions = await listVideoCaptions(url, idHttp) | ||
67 | expect(resCaptions.body.total).to.equal(2) | ||
65 | } | 68 | } |
66 | 69 | ||
67 | async function checkVideoServer2 (url: string, id: number | string) { | 70 | async function checkVideoServer2 (url: string, id: number | string) { |
68 | const res = await getVideo(url, id) | 71 | const res = await getVideo(url, id) |
69 | const video = res.body | 72 | const video: VideoDetails = res.body |
70 | 73 | ||
71 | expect(video.name).to.equal('my super name') | 74 | expect(video.name).to.equal('my super name') |
72 | expect(video.category.label).to.equal('Entertainment') | 75 | expect(video.category.label).to.equal('Entertainment') |
@@ -77,6 +80,9 @@ describe('Test video imports', function () { | |||
77 | expect(video.tags).to.deep.equal([ 'supertag1', 'supertag2' ]) | 80 | expect(video.tags).to.deep.equal([ 'supertag1', 'supertag2' ]) |
78 | 81 | ||
79 | expect(video.files).to.have.lengthOf(1) | 82 | expect(video.files).to.have.lengthOf(1) |
83 | |||
84 | const resCaptions = await listVideoCaptions(url, id) | ||
85 | expect(resCaptions.body.total).to.equal(2) | ||
80 | } | 86 | } |
81 | 87 | ||
82 | before(async function () { | 88 | before(async function () { |
@@ -114,44 +120,42 @@ describe('Test video imports', function () { | |||
114 | expect(res.body.video.name).to.equal('small video - youtube') | 120 | expect(res.body.video.name).to.equal('small video - youtube') |
115 | 121 | ||
116 | const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id) | 122 | const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id) |
117 | const videoCaptions: VideoCaption[] = resCaptions.body | 123 | const videoCaptions: VideoCaption[] = resCaptions.body.data |
118 | expect(videoCaptions).to.have.lengthOf(2) | 124 | expect(videoCaptions).to.have.lengthOf(2) |
119 | 125 | ||
120 | const enCaption = videoCaptions.filter(caption => caption.language.label === 'en')[0] | 126 | const enCaption = videoCaptions.find(caption => caption.language.id === 'en') |
121 | expect(enCaption).to.not(undefined) | 127 | expect(enCaption).to.exist |
122 | expect(enCaption.language.label).to.equal('en') | 128 | expect(enCaption.language.label).to.equal('English') |
123 | expect(enCaption.captionPath).to.equal(`/static/video-captions/${res.body.video.uuid}-en.vtt`) | 129 | expect(enCaption.captionPath).to.equal(`/static/video-captions/${res.body.video.uuid}-en.vtt`) |
124 | await testCaptionFile(servers[0].url, enCaption.captionPath, `WEBVTT | 130 | await testCaptionFile(servers[0].url, enCaption.captionPath, `WEBVTT |
131 | Kind: captions | ||
132 | Language: en | ||
125 | 133 | ||
126 | 1 | 134 | 00:00:01.600 --> 00:00:04.200 |
127 | 00:00:01.600 --> 00:00:04.200 | 135 | English (US) |
128 | English (US) | ||
129 | 136 | ||
130 | 2 | 137 | 00:00:05.900 --> 00:00:07.999 |
131 | 00:00:05.900 --> 00:00:07.999 | 138 | This is a subtitle in American English |
132 | This is a subtitle in American English | ||
133 | 139 | ||
134 | 3 | 140 | 00:00:10.000 --> 00:00:14.000 |
135 | 00:00:10.000 --> 00:00:14.000 | 141 | Adding subtitles is very easy to do`) |
136 | Adding subtitles is very easy to do`) | ||
137 | 142 | ||
138 | const frCaption = videoCaptions.filter(caption => caption.language.label === 'fr')[0] | 143 | const frCaption = videoCaptions.find(caption => caption.language.id === 'fr') |
139 | expect(frCaption).to.not(undefined) | 144 | expect(frCaption).to.exist |
140 | expect(frCaption.language.label).to.equal('fr') | 145 | expect(frCaption.language.label).to.equal('French') |
141 | expect(frCaption.captionPath).to.equal(`/static/video-captions/${res.body.video.uuid}-en.vtt`) | 146 | expect(frCaption.captionPath).to.equal(`/static/video-captions/${res.body.video.uuid}-fr.vtt`) |
142 | await testCaptionFile(servers[0].url, frCaption.captionPath, `WEBVTT | 147 | await testCaptionFile(servers[0].url, frCaption.captionPath, `WEBVTT |
148 | Kind: captions | ||
149 | Language: fr | ||
143 | 150 | ||
144 | 1 | 151 | 00:00:01.600 --> 00:00:04.200 |
145 | 00:00:01,600 --> 00:00:04.200 | 152 | Français (FR) |
146 | Français (FR) | ||
147 | 153 | ||
148 | 2 | 154 | 00:00:05.900 --> 00:00:07.999 |
149 | 00:00:05,900 --> 00:00:07.999 | 155 | C'est un sous-titre français |
150 | C'est un sous-titre français | ||
151 | 156 | ||
152 | 3 | 157 | 00:00:10.000 --> 00:00:14.000 |
153 | 00:00:10,000 --> 00:00:14.000 | 158 | Ajouter un sous-titre est vraiment facile`) |
154 | Ajouter un sous-titre est vraiment facile`) | ||
155 | } | 159 | } |
156 | 160 | ||
157 | { | 161 | { |