From 0cc253c9719b1e361d33d62adcef4c292cc98be9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 18 May 2022 08:44:20 +0200 Subject: Fix import tests --- server/tests/api/videos/video-imports.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 28da69e8e..7482a7ceb 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts @@ -143,9 +143,11 @@ describe('Test video imports', function () { expect(enCaption.language.label).to.equal('English') expect(enCaption.captionPath).to.match(new RegExp(`^/lazy-static/video-captions/.+-en.vtt$`)) - const regex = `WEBVTT[ \n]+Kind: captions[ \n]+Language: en[ \n]+00:00:01.600 --> 00:00:04.200[ \n]+English \\(US\\)[ \n]+` + - `00:00:05.900 --> 00:00:07.999[ \n]+This is a subtitle in American English[ \n]+` + - `00:00:10.000 --> 00:00:14.000[ \n]+Adding subtitles is very easy to do` + const regex = `WEBVTT[ \n]+Kind: captions[ \n]+` + + `(Language: en[ \n]+)?` + + `00:00:01.600 --> 00:00:04.200 (position:\\d+% line:\\d+%)?[ \n]+English \\(US\\)[ \n]+` + + `00:00:05.900 --> 00:00:07.999 (position:\\d+% line:\\d+%)?[ \n]+This is a subtitle in American English[ \n]+` + + `00:00:10.000 --> 00:00:14.000 (position:\\d+% line:\\d+%)?[ \n]+Adding subtitles is very easy to do` await testCaptionFile(servers[0].url, enCaption.captionPath, new RegExp(regex)) } @@ -155,9 +157,11 @@ describe('Test video imports', function () { expect(frCaption.language.label).to.equal('French') expect(frCaption.captionPath).to.match(new RegExp(`^/lazy-static/video-captions/.+-fr.vtt`)) - const regex = `WEBVTT[ \n]+Kind: captions[ \n]+Language: fr[ \n]+00:00:01.600 --> 00:00:04.200[ \n]+` + - `Français \\(FR\\)[ \n]+00:00:05.900 --> 00:00:07.999[ \n]+C'est un sous-titre français[ \n]+` + - `00:00:10.000 --> 00:00:14.000[ \n]+Ajouter un sous-titre est vraiment facile` + const regex = `WEBVTT[ \n]+Kind: captions[ \n]+` + + `(Language: fr[ \n]+)?` + + `00:00:01.600 --> 00:00:04.200 (position:\\d+% line:\\d+%)?[ \n]+Français \\(FR\\)[ \n]+` + + `00:00:05.900 --> 00:00:07.999 (position:\\d+% line:\\d+%)?[ \n]+C'est un sous-titre français[ \n]+` + + `00:00:10.000 --> 00:00:14.000 (position:\\d+% line:\\d+%)?[ \n]+Ajouter un sous-titre est vraiment facile` await testCaptionFile(servers[0].url, frCaption.captionPath, new RegExp(regex)) } -- cgit v1.2.3