aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/tests/src
diff options
context:
space:
mode:
authorSeth Falco <seth@falco.fun>2023-08-02 23:22:36 +0100
committerChocobozzz <chocobozzz@cpy.re>2023-08-18 10:17:16 +0200
commit2055962c844e557d628d9d0aae9303590c39eab8 (patch)
treee1ead9fc49f6b70e51e3728485d5c6b6c2d7fba9 /packages/tests/src
parent8e4fba97b26090e0c77ee9591058cd34ef9d2f55 (diff)
downloadPeerTube-2055962c844e557d628d9d0aae9303590c39eab8.tar.gz
PeerTube-2055962c844e557d628d9d0aae9303590c39eab8.tar.zst
PeerTube-2055962c844e557d628d9d0aae9303590c39eab8.zip
fix: handle git installation of ffmpeg
Diffstat (limited to 'packages/tests/src')
-rw-r--r--packages/tests/src/server-helpers/core-utils.ts53
1 files changed, 52 insertions, 1 deletions
diff --git a/packages/tests/src/server-helpers/core-utils.ts b/packages/tests/src/server-helpers/core-utils.ts
index 06c78591e..d61cae855 100644
--- a/packages/tests/src/server-helpers/core-utils.ts
+++ b/packages/tests/src/server-helpers/core-utils.ts
@@ -5,7 +5,7 @@ import snakeCase from 'lodash-es/snakeCase.js'
5import validator from 'validator' 5import validator from 'validator'
6import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate } from '@peertube/peertube-core-utils' 6import { getAverageTheoreticalBitrate, getMaxTheoreticalBitrate } from '@peertube/peertube-core-utils'
7import { VideoResolution } from '@peertube/peertube-models' 7import { VideoResolution } from '@peertube/peertube-models'
8import { objectConverter, parseBytes, parseDurationToMs } from '@peertube/peertube-server/server/helpers/core-utils.js' 8import { objectConverter, parseBytes, parseDurationToMs, parseSemVersion } from '@peertube/peertube-server/server/helpers/core-utils.js'
9 9
10describe('Parse Bytes', function () { 10describe('Parse Bytes', function () {
11 11
@@ -148,3 +148,54 @@ describe('Bitrate', function () {
148 } 148 }
149 }) 149 })
150}) 150})
151
152describe('Parse semantic version string', function () {
153
154 it('Should parse Node.js version string', function () {
155 const actual = parseSemVersion('v18.16.0')
156
157 expect(actual.major).to.equal(18)
158 expect(actual.minor).to.equal(16)
159 expect(actual.patch).to.equal(0)
160 })
161
162 it('Should parse FFmpeg version string from Debian 12 repo', function () {
163 const actual = parseSemVersion('5.1.3-1')
164
165 expect(actual.major).to.equal(5)
166 expect(actual.minor).to.equal(1)
167 expect(actual.patch).to.equal(3)
168 })
169
170 it('Should parse FFmpeg version string from Arch repo', function () {
171 const actual = parseSemVersion('n6.0')
172
173 expect(actual.major).to.equal(6)
174 expect(actual.minor).to.equal(0)
175 expect(actual.patch).to.equal(0)
176 })
177
178 it('Should parse FFmpeg version from GitHub release', function () {
179 const actual = parseSemVersion('5.1.3')
180
181 expect(actual.major).to.equal(5)
182 expect(actual.minor).to.equal(1)
183 expect(actual.patch).to.equal(3)
184 })
185
186 it('Should parse FFmpeg version from GitHub dev release', function () {
187 const actual = parseSemVersion('5.1.git')
188
189 expect(actual.major).to.equal(5)
190 expect(actual.minor).to.equal(1)
191 expect(actual.patch).to.equal(0)
192 })
193
194 it('Should parse FFmpeg version string with missing patch segment', function () {
195 const actual = parseSemVersion('4.4')
196
197 expect(actual.major).to.equal(4)
198 expect(actual.minor).to.equal(4)
199 expect(actual.patch).to.equal(0)
200 })
201})