Harden render validation tests for input paths and empty transcript output

This commit is contained in:
2026-05-24 23:00:10 +00:00
parent 761d70bbc6
commit 6dfc1ea527
2 changed files with 74 additions and 0 deletions

View File

@@ -224,6 +224,40 @@ func TestRenderSupportsMinimalIntermediateAndFullInputs(t *testing.T) {
}
}
func TestRenderEmptyTranscriptIsDeterministic(t *testing.T) {
dir := t.TempDir()
input := writeJSONFile(t, dir, "input.json", `{
"metadata": {
"application": "seriatim",
"version": "v-test",
"output_schema": "seriatim-minimal"
},
"segments": []
}`)
output := writeJSONFile(t, dir, "output.md", "")
run := func() string {
err := executeRender(
"--input-file", input,
"--output-file", output,
"--format", config.RenderFormatMarkdown,
)
if err != nil {
t.Fatalf("render failed: %v", err)
}
return readFile(t, output)
}
first := run()
second := run()
if first != second {
t.Fatalf("empty transcript render is not deterministic:\nfirst:\n%s\nsecond:\n%s", first, second)
}
if first != "# Transcript\n" {
t.Fatalf("unexpected empty transcript output:\n%s", first)
}
}
func executeRender(args ...string) error {
cmd := NewRootCommand()
cmd.SetArgs(append([]string{"render"}, args...))