add manager tests

This commit is contained in:
Alan Trebugeais
2026-05-09 19:30:40 +02:00
parent ef993a09d0
commit 561090a473
2 changed files with 31 additions and 1 deletions
+30
View File
@@ -172,4 +172,34 @@ describe("local media path policy", () => {
expect(result.path).toBe(projectPath);
expect(result.project).toMatchObject({ videoPath });
});
it("approves editor audioRegions audioPath entries when loading a project", async () => {
const downloadsPath = path.join(tempRoot, "Downloads");
const videoPath = path.join(tempPath, "recording.mp4");
const audioPath = path.join(downloadsPath, "music.ogg");
const projectPath = path.join(tempPath, "recording.recordly");
await fs.mkdir(downloadsPath, { recursive: true });
await fs.writeFile(videoPath, "test-video");
await fs.writeFile(audioPath, "test-audio");
await fs.writeFile(
projectPath,
JSON.stringify({
version: 1,
videoPath,
editor: {
audioRegions: [
{ id: "a1", startMs: 0, endMs: 1000, audioPath, volume: 1 },
],
},
}),
"utf-8",
);
const { loadProjectFromPath, resolveApprovedLocalMediaPath } = await import("./manager");
const resolvedAudioPath = await fs.realpath(audioPath);
const result = await loadProjectFromPath(projectPath);
expect(result.success).toBe(true);
await expect(resolveApprovedLocalMediaPath(audioPath)).resolves.toBe(resolvedAudioPath);
});
});
+1 -1
View File
@@ -32,7 +32,7 @@ export function getBrowserMicSidecarFilters(profile?: string | null) {
return BROWSER_MIC_SIDECAR_FILTERS;
}
export const RECORDING_AUDIO_SIDECAR_DEBUG_ENV = "RECORDLY_KEEP_RECORDING_AUDIO_SIDECARS";
export const RECORDING_AUDIO_SIDECAR_DEBUG_ENV = "RECORDLY_KEEP_RECORDING_AUDIO_SIDECARS"; // not used yet, because we need to have seperate audio files for system and mic for each recording
export function shouldKeepRecordingAudioSidecars(env: NodeJS.ProcessEnv = process.env) {
const value = env[RECORDING_AUDIO_SIDECAR_DEBUG_ENV]?.trim().toLowerCase();