Harden render validation tests for input paths and empty transcript output
This commit is contained in:
@@ -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...))
|
||||
|
||||
Reference in New Issue
Block a user