From b1770a0af464ad6350d156245b1abcc1395e142e Mon Sep 17 00:00:00 2001 From: Kim <1877318+kimsible@users.noreply.github.com> Date: Mon, 20 Apr 2020 10:28:38 +0200 Subject: Add thumbnail / preview generation from url on the fly (#2646) * Add thumbnails generation on the fly to URL import * Display generated preview to import first edit * Use ternary to get type inference * Move preview/thumbnail test just after import Co-authored-by: kimsible --- server/tests/api/videos/video-imports.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'server/tests/api') diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 8e179b825..4d5989f43 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts @@ -19,6 +19,7 @@ import { } from '../../../../shared/extra-utils' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' +import { testImage } from '../../../../shared/extra-utils/miscs/miscs' const expect = chai.expect @@ -118,6 +119,10 @@ describe('Test video imports', function () { const attributes = immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() }) const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) expect(res.body.video.name).to.equal('small video - youtube') + expect(res.body.video.thumbnailPath).to.equal(`/static/thumbnails/${res.body.video.uuid}.jpg`) + expect(res.body.video.previewPath).to.equal(`/static/previews/${res.body.video.uuid}.jpg`) + await testImage(servers[0].url, 'video_import_thumbnail', res.body.video.thumbnailPath) + await testImage(servers[0].url, 'video_import_preview', res.body.video.previewPath) const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id) const videoCaptions: VideoCaption[] = resCaptions.body.data -- cgit v1.2.3