Fix tests

This commit is contained in:
Chocobozzz 2024-02-28 10:00:01 +01:00
parent cf60f7af03
commit 4434e78c56
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 17 additions and 4 deletions

View File

@ -145,8 +145,13 @@ async function completeCheckHlsPlaylist (options: {
expect(file.resolution.label).to.equal(resolution + 'p') expect(file.resolution.label).to.equal(resolution + 'p')
} }
if (resolution === 0) {
expect(file.height).to.equal(0)
expect(file.width).to.equal(0)
} else {
expect(Math.min(file.height, file.width)).to.equal(resolution) expect(Math.min(file.height, file.width)).to.equal(resolution)
expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution) expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution)
}
expect(file.magnetUri).to.have.lengthOf.above(2) expect(file.magnetUri).to.have.lengthOf.above(2)
await checkWebTorrentWorks(file.magnetUri) await checkWebTorrentWorks(file.magnetUri)

View File

@ -104,8 +104,13 @@ export async function completeWebVideoFilesCheck (options: {
if (attributeFile.width !== undefined) expect(file.width).to.equal(attributeFile.width) if (attributeFile.width !== undefined) expect(file.width).to.equal(attributeFile.width)
if (attributeFile.height !== undefined) expect(file.height).to.equal(attributeFile.height) if (attributeFile.height !== undefined) expect(file.height).to.equal(attributeFile.height)
if (file.resolution.id === VideoResolution.H_NOVIDEO) {
expect(file.height).to.equal(0)
expect(file.width).to.equal(0)
} else {
expect(Math.min(file.height, file.width)).to.equal(file.resolution.id) expect(Math.min(file.height, file.width)).to.equal(file.resolution.id)
expect(Math.max(file.height, file.width)).to.be.greaterThan(file.resolution.id) expect(Math.max(file.height, file.width)).to.be.greaterThan(file.resolution.id)
}
if (attributeFile.size) { if (attributeFile.size) {
const minSize = attributeFile.size - ((10 * attributeFile.size) / 100) const minSize = attributeFile.size - ((10 * attributeFile.size) / 100)

View File

@ -27,7 +27,10 @@ async function buildNewFile (options: {
}) })
if (await isAudioFile(path, probe)) { if (await isAudioFile(path, probe)) {
videoFile.fps = 0
videoFile.resolution = VideoResolution.H_NOVIDEO videoFile.resolution = VideoResolution.H_NOVIDEO
videoFile.width = 0
videoFile.height = 0
} else { } else {
const dimensions = await getVideoStreamDimensionsInfo(path, probe) const dimensions = await getVideoStreamDimensionsInfo(path, probe)
videoFile.fps = await getVideoStreamFPS(path, probe) videoFile.fps = await getVideoStreamFPS(path, probe)