mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-02 14:29:54 +08:00
* fix(render): recover first-frame screenshot timeouts at lower concurrency * fix(render): type diagnostic lookup keys and tracked reasons * fix(export): verify playable frames and report failed checks * Type export verification checks against the telemetry allowlist --------- Co-authored-by: qindong <qindong@qindongs-MacBook-Pro.local>
35 lines
1.9 KiB
TypeScript
35 lines
1.9 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
|
|
import { tmpdir } from 'node:os';
|
|
import path from 'node:path';
|
|
import { verifyExport } from '../../scripts/verify-export.ts';
|
|
import { verificationCheckNames } from '../../tracking/tool-fields.ts';
|
|
import { mediaBytes } from '../media-fixtures.ts';
|
|
|
|
test('a missing probe reports both blocked checks using telemetry check names', async t => {
|
|
const directory = await mkdtemp(path.join(tmpdir(), 'motion-verify-'));
|
|
t.after(() => rm(directory, { recursive: true, force: true }));
|
|
const file = path.join(directory, 'video.mp4');
|
|
await writeFile(file, 'fixture');
|
|
const missing = path.join(directory, 'missing-binary');
|
|
const report = await verifyExport(file, 1, { ffprobe: missing, ffmpeg: missing });
|
|
assert.equal(report.status, 'blocked');
|
|
const blockedNames = report.checks.filter(check => check.status === 'not_run').map(check => check.name);
|
|
assert.deepEqual(blockedNames, ['probe', 'decode-and-seek']);
|
|
for (const name of blockedNames) assert.ok(verificationCheckNames.includes(name));
|
|
});
|
|
|
|
test('seek checks use encoded frames while duration checks enforce the authored tolerance', async t => {
|
|
const directory = await mkdtemp(path.join(tmpdir(), 'motion-verify-'));
|
|
t.after(() => rm(directory, { recursive: true, force: true }));
|
|
const file = path.join(directory, 'two-frames.mp4');
|
|
await writeFile(file, await mediaBytes('video'));
|
|
const spec = { width: 32, height: 24, fps: 10, audio: 'optional' as const };
|
|
const within = await verifyExport(file, { ...spec, duration: 0.24 });
|
|
assert.equal(within.status, 'passed', JSON.stringify(within.checks));
|
|
const outside = await verifyExport(file, { ...spec, duration: 0.42 });
|
|
assert.equal(outside.status, 'failed');
|
|
assert.equal(outside.checks.find(check => check.name === 'decoded-duration')?.reason, 'expectation_mismatch');
|
|
});
|