diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-05 16:37:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:16 +0200 |
commit | 329619b3453479f76c049816b7403b86e9d45cb5 (patch) | |
tree | e522940946402a4284d356f2cde8e0dcbe29b289 /server/tests/cli/print-transcode-command.ts | |
parent | a6a79eae0d8564099b6957e76d7a18528d9ef124 (diff) | |
download | PeerTube-329619b3453479f76c049816b7403b86e9d45cb5.tar.gz PeerTube-329619b3453479f76c049816b7403b86e9d45cb5.tar.zst PeerTube-329619b3453479f76c049816b7403b86e9d45cb5.zip |
Introduce CLI command
Diffstat (limited to 'server/tests/cli/print-transcode-command.ts')
-rw-r--r-- | server/tests/cli/print-transcode-command.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/tests/cli/print-transcode-command.ts b/server/tests/cli/print-transcode-command.ts index 2d7255db7..3a7969e68 100644 --- a/server/tests/cli/print-transcode-command.ts +++ b/server/tests/cli/print-transcode-command.ts | |||
@@ -2,14 +2,15 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { execCLI } from '../../../shared/extra-utils' | 5 | import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils' |
6 | import { CLICommand } from '@shared/extra-utils' | ||
6 | import { getTargetBitrate, VideoResolution } from '../../../shared/models/videos' | 7 | import { getTargetBitrate, VideoResolution } from '../../../shared/models/videos' |
7 | import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants' | 8 | import { VIDEO_TRANSCODING_FPS } from '../../initializers/constants' |
8 | import { getVideoFileBitrate, getVideoFileFPS } from '@server/helpers/ffprobe-utils' | ||
9 | 9 | ||
10 | const expect = chai.expect | 10 | const expect = chai.expect |
11 | 11 | ||
12 | describe('Test create transcoding jobs', function () { | 12 | describe('Test create transcoding jobs', function () { |
13 | |||
13 | it('Should print the correct command for each resolution', async function () { | 14 | it('Should print the correct command for each resolution', async function () { |
14 | const fixturePath = 'server/tests/fixtures/video_short.webm' | 15 | const fixturePath = 'server/tests/fixtures/video_short.webm' |
15 | const fps = await getVideoFileFPS(fixturePath) | 16 | const fps = await getVideoFileFPS(fixturePath) |
@@ -19,7 +20,7 @@ describe('Test create transcoding jobs', function () { | |||
19 | VideoResolution.H_720P, | 20 | VideoResolution.H_720P, |
20 | VideoResolution.H_1080P | 21 | VideoResolution.H_1080P |
21 | ]) { | 22 | ]) { |
22 | const command = await execCLI(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`) | 23 | const command = await CLICommand.exec(`npm run print-transcode-command -- ${fixturePath} -r ${resolution}`) |
23 | const targetBitrate = Math.min(getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS), bitrate) | 24 | const targetBitrate = Math.min(getTargetBitrate(resolution, fps, VIDEO_TRANSCODING_FPS), bitrate) |
24 | 25 | ||
25 | expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`) | 26 | expect(command).to.includes(`-vf scale=w=-2:h=${resolution}`) |