X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fcli%2Fprint-transcode-command.ts;h=27896f0310f804ca482dc53a9e1530268800cc7b;hb=3318147300b4f998adf728eb0a5a14a4c1829c51;hp=3a7969e681884e4ef8cd7ae018b16495797c48c1;hpb=ac27887774e63d99f4e227fbe18846f143cc4b3c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/cli/print-transcode-command.ts b/server/tests/cli/print-transcode-command.ts index 3a7969e68..27896f031 100644 --- a/server/tests/cli/print-transcode-command.ts +++ b/server/tests/cli/print-transcode-command.ts @@ -2,26 +2,22 @@ import 'mocha' import * as chai from 'chai' -import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils' -import { CLICommand } from '@shared/extra-utils' -import { getTargetBitrate, VideoResolution } from '../../../shared/models/videos' -import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants' +import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { CLICommand } from '@shared/server-commands' +import { VideoResolution } from '../../../shared/models/videos' const expect = chai.expect -describe('Test create transcoding jobs', function () { +describe('Test print transcode jobs', function () { it('Should print the correct command for each resolution', async function () { - const fixturePath = 'server/tests/fixtures/video_short.webm' - const fps = await getVideoFileFPS(fixturePath) - const bitrate = await getVideoFileBitrate(fixturePath) + const fixturePath = buildAbsoluteFixturePath('video_short.webm') for (const resolution of [ VideoResolution.H_720P, VideoResolution.H_1080P ]) { const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`) - const targetBitrate = Math.min(getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS), bitrate) expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`) expect(command).to.includes(`-y -acodec aac -vcodec libx264`) @@ -31,8 +27,8 @@ describe('Test create transcoding jobs', function () { expect(command).to.includes('-r 25') expect(command).to.includes('-level:v 3.1') expect(command).to.includes('-g:v 50') - expect(command).to.includes(`-maxrate ${targetBitrate}`) - expect(command).to.includes(`-bufsize ${targetBitrate * 2}`) + expect(command).to.includes(`-maxrate `) + expect(command).to.includes(`-bufsize `) } }) })