Updated documentation and tests to reflect the new render command
This commit is contained in:
@@ -522,6 +522,86 @@ func TestRenderCommandOutWritesToFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderCommandPromptDefaultProfileWorksThroughCLIPath(t *testing.T) {
|
||||
tmp := t.TempDir()
|
||||
promptDir := filepath.Join(tmp, "prompts")
|
||||
profileDir := filepath.Join(tmp, "profiles")
|
||||
if err := os.MkdirAll(promptDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.MkdirAll(profileDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
inputPath := filepath.Join(tmp, "transcript.md")
|
||||
if err := os.WriteFile(inputPath, []byte("hello"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
writePromptFile(t, promptDir, "prompt.default", "local-default")
|
||||
writeProfileFile(t, profileDir, "local-default", "http://127.0.0.1:1/v1", "default-model")
|
||||
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
code := renderCommand([]string{
|
||||
"--prompt-dir", promptDir,
|
||||
"--profile-dir", profileDir,
|
||||
"--prompt", "prompt.default",
|
||||
"--input", "transcript=" + inputPath,
|
||||
}, &stdout, &stderr)
|
||||
|
||||
if code != ExitOK {
|
||||
t.Fatalf("expected ExitOK, got %d stderr=%q", code, stderr.String())
|
||||
}
|
||||
out := stdout.String()
|
||||
if !strings.Contains(out, "selected_profile_id: local-default") {
|
||||
t.Fatalf("expected prompt default profile in output, got %q", out)
|
||||
}
|
||||
if !strings.Contains(out, "model: default-model") {
|
||||
t.Fatalf("expected model from default profile in output, got %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderCommandExplicitProfileOverridesPromptDefault(t *testing.T) {
|
||||
tmp := t.TempDir()
|
||||
promptDir := filepath.Join(tmp, "prompts")
|
||||
profileDir := filepath.Join(tmp, "profiles")
|
||||
if err := os.MkdirAll(promptDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.MkdirAll(profileDir, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
inputPath := filepath.Join(tmp, "transcript.md")
|
||||
if err := os.WriteFile(inputPath, []byte("hello"), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
writePromptFile(t, promptDir, "prompt.default", "local-default")
|
||||
writeProfileFile(t, profileDir, "local-default", "http://127.0.0.1:1/v1", "default-model")
|
||||
writeProfileFile(t, profileDir, "quality", "http://127.0.0.1:1/v1", "quality-model")
|
||||
|
||||
var stdout bytes.Buffer
|
||||
var stderr bytes.Buffer
|
||||
code := renderCommand([]string{
|
||||
"--prompt-dir", promptDir,
|
||||
"--profile-dir", profileDir,
|
||||
"--prompt", "prompt.default",
|
||||
"--profile", "quality",
|
||||
"--input", "transcript=" + inputPath,
|
||||
}, &stdout, &stderr)
|
||||
|
||||
if code != ExitOK {
|
||||
t.Fatalf("expected ExitOK, got %d stderr=%q", code, stderr.String())
|
||||
}
|
||||
out := stdout.String()
|
||||
if !strings.Contains(out, "selected_profile_id: quality") {
|
||||
t.Fatalf("expected explicit profile in output, got %q", out)
|
||||
}
|
||||
if !strings.Contains(out, "model: quality-model") {
|
||||
t.Fatalf("expected model from explicit profile in output, got %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunCommandPromptDefaultProfileWorksThroughCLIPath(t *testing.T) {
|
||||
tmp := t.TempDir()
|
||||
promptDir := filepath.Join(tmp, "prompts")
|
||||
|
||||
Reference in New Issue
Block a user