From 6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 Jun 2018 19:16:00 +0200 Subject: Fix import with when the imported file has the same extension than an already existing file --- server/tests/cli/create-import-video-file-job.ts | 32 +++++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'server/tests/cli') diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index 372c7e517..1472e60f6 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -73,22 +73,22 @@ describe('Test create import video jobs', function () { expect(videoDetail.files).to.have.lengthOf(2) const [originalVideo, transcodedVideo] = videoDetail.files - assertVideoProperties(originalVideo, 720, 'webm') - assertVideoProperties(transcodedVideo, 480, 'webm') + assertVideoProperties(originalVideo, 720, 'webm', 218910) + assertVideoProperties(transcodedVideo, 480, 'webm', 69217) if (!magnetUri) magnetUri = transcodedVideo.magnetUri else expect(transcodedVideo.magnetUri).to.equal(magnetUri) } }) - it('Should run a import job on video 2 with the same resolution', async function () { + it('Should run a import job on video 2 with the same resolution and a different extension', async function () { const env = getEnvCli(servers[1]) await execCLI(`${env} npm run create-import-video-file-job -- -v ${video2UUID} -i server/tests/fixtures/video_short.ogv`) await wait(30000) let magnetUri: string - for (const server of servers.reverse()) { + for (const server of servers) { const { data: videos } = (await getVideosList(server.url)).body expect(videos).to.have.lengthOf(2) @@ -107,6 +107,30 @@ describe('Test create import video jobs', function () { } }) + it('Should run a import job on video 2 with the same resolution and the same extension', async function () { + const env = getEnvCli(servers[0]) + await execCLI(`${env} npm run create-import-video-file-job -- -v ${video1UUID} -i server/tests/fixtures/video_short2.webm`) + + await wait(30000) + + let magnetUri: string + for (const server of servers) { + const { data: videos } = (await getVideosList(server.url)).body + expect(videos).to.have.lengthOf(2) + + const video = videos.find(({ uuid }) => uuid === video1UUID) + const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body + + expect(videoDetail.files).to.have.lengthOf(2) + const [ video720, video480 ] = videoDetail.files + assertVideoProperties(video720, 720, 'webm', 942961) + assertVideoProperties(video480, 480, 'webm', 69217) + + if (!magnetUri) magnetUri = video720.magnetUri + else expect(video720.magnetUri).to.equal(magnetUri) + } + }) + after(async function () { killallServers(servers) -- cgit v1.2.3