Strengthen startup and error regression tests

This commit is contained in:
2026-11-25 17:31:38 +00:00
parent 93ab0e5969
commit 989f4edeca
4 changed files with 54 additions and 10 deletions

View File

@@ -31,13 +31,15 @@ func TestNativeMetadataWithoutConfiguration(t *testing.T) {
}
func TestRemovedSourceAndSchemaFlagsAreRejected(t *testing.T) {
for _, command := range [][]string{{"run"}, {"serve"}, {"config", "show"}, {"promptkit", "list", "prompts"}} {
nativePromptFixture(t, "http://127.0.0.1:1/v1")
for _, command := range [][]string{{"run", "support/summary"}, {"serve"}, {"config", "show"}, {"promptkit", "list", "prompts"}} {
for _, flag := range []string{"--promptkit-source=missing.yml", "--schema-dir=schemas"} {
args := append(append([]string{}, command...), flag)
args := append(append([]string{}, command...), "--config=app.yml", flag)
var output, diagnostics bytes.Buffer
outcome := Execute(context.Background(), commandkit.Identity{Name: "scriptorium"}, args, &output, &diagnostics)
if outcome.Kind != commandkit.OutcomeUsage || outcome.Status != 2 {
t.Fatalf("%v: %+v", args, outcome)
flagName := strings.SplitN(flag, "=", 2)[0]
if outcome.Kind != commandkit.OutcomeUsage || outcome.Status != 2 || !strings.Contains(diagnostics.String(), flagName) {
t.Fatalf("%v: %+v diagnostics=%q", args, outcome, diagnostics.String())
}
}
}