mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-12 07:09:59 +00:00
fix(cli): validate init flags before creating the project directory (#1207)
Co-authored-by: Carlos Alcaraz <193642530+calcarazgre646@users.noreply.github.com>
This commit is contained in:
co-authored by
Carlos Alcaraz
parent
8306b2c0b4
commit
a4ae3c92a0
@@ -147,6 +147,51 @@ describe("hyperframes init flag rename", () => {
|
||||
]);
|
||||
expect(res.status).toBe(1);
|
||||
expect(res.stderr).toContain("Video file not found: missing.mp4");
|
||||
expect(existsSync(target)).toBe(false);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("--audio with a missing file fails without creating the project directory", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "hf-init-test-"));
|
||||
const target = join(dir, "proj");
|
||||
try {
|
||||
const res = runInit([
|
||||
target,
|
||||
"--example",
|
||||
"blank",
|
||||
"--non-interactive",
|
||||
"--skip-skills",
|
||||
"--audio",
|
||||
"missing.mp3",
|
||||
]);
|
||||
expect(res.status).toBe(1);
|
||||
expect(res.stderr).toContain("Audio file not found: missing.mp3");
|
||||
expect(existsSync(target)).toBe(false);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("--video and --audio together fail without creating the project directory", () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "hf-init-test-"));
|
||||
const target = join(dir, "proj");
|
||||
try {
|
||||
const res = runInit([
|
||||
target,
|
||||
"--example",
|
||||
"blank",
|
||||
"--non-interactive",
|
||||
"--skip-skills",
|
||||
"--video",
|
||||
"clip.mp4",
|
||||
"--audio",
|
||||
"track.mp3",
|
||||
]);
|
||||
expect(res.status).toBe(1);
|
||||
expect(res.stderr).toContain("Cannot use --video and --audio together");
|
||||
expect(existsSync(target)).toBe(false);
|
||||
} finally {
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user