From 04bf312cdac0fe601864c19bdbd4f24c73ae08ae Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 30 May 2018 11:11:51 +0200 Subject: Improve create transcoding jobs tests --- server/tests/cli/create-transcoding-job.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/tests') diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts index c2214d285..557dd8af9 100644 --- a/server/tests/cli/create-transcoding-job.ts +++ b/server/tests/cli/create-transcoding-job.ts @@ -72,12 +72,27 @@ describe('Test create transcoding jobs', function () { const videos = res.body.data expect(videos).to.have.lengthOf(2) + let infoHashes: { [ id: number ]: string } + for (const video of videos) { const res2 = await getVideo(server.url, video.uuid) const videoDetail: VideoDetails = res2.body if (video.uuid === video2UUID) { expect(videoDetail.files).to.have.lengthOf(4) + + if (!infoHashes) { + infoHashes = {} + + for (const file of videoDetail.files) { + infoHashes[file.resolution.id.toString()] = file.magnetUri + } + } else { + for (const resolution of Object.keys(infoHashes)) { + const file = videoDetail.files.find(f => f.resolution.id.toString() === resolution) + expect(file.magnetUri).to.equal(infoHashes[resolution]) + } + } } else { expect(videoDetail.files).to.have.lengthOf(1) } -- cgit v1.2.3