Fix import tests

This commit is contained in:
Chocobozzz 2022-05-18 08:44:20 +02:00
parent f4120aea7a
commit 0cc253c971
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 6 deletions

View File

@ -143,9 +143,11 @@ describe('Test video imports', function () {
expect(enCaption.language.label).to.equal('English') expect(enCaption.language.label).to.equal('English')
expect(enCaption.captionPath).to.match(new RegExp(`^/lazy-static/video-captions/.+-en.vtt$`)) 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]+` + const regex = `WEBVTT[ \n]+Kind: captions[ \n]+` +
`00:00:05.900 --> 00:00:07.999[ \n]+This is a subtitle in American English[ \n]+` + `(Language: en[ \n]+)?` +
`00:00:10.000 --> 00:00:14.000[ \n]+Adding subtitles is very easy to do` `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)) 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.language.label).to.equal('French')
expect(frCaption.captionPath).to.match(new RegExp(`^/lazy-static/video-captions/.+-fr.vtt`)) 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]+` + const regex = `WEBVTT[ \n]+Kind: captions[ \n]+` +
`Français \\(FR\\)[ \n]+00:00:05.900 --> 00:00:07.999[ \n]+C'est un sous-titre français[ \n]+` + `(Language: fr[ \n]+)?` +
`00:00:10.000 --> 00:00:14.000[ \n]+Ajouter un sous-titre est vraiment facile` `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)) await testCaptionFile(servers[0].url, frCaption.captionPath, new RegExp(regex))
} }