Migrate prompt fixtures to direct definitions
This commit is contained in:
@@ -64,13 +64,13 @@ func TestValidationCommandComposesWithRequirementsShow(t *testing.T) {
|
||||
outcome = app.Execute(context.Background(), []string{
|
||||
"promptkit", "requirements", "validate", "briefing",
|
||||
"--config", "config.yml", "--overlay", "overlay.yml", "--campaign", "spring",
|
||||
"--version", "v2", "--profile", "editorial", "--session-id", "session-1",
|
||||
"--profile", "editorial", "--session-id", "session-1",
|
||||
"--var", "topic=roadmap", "--input", "notes=fixtures/notes=final.txt", "--format", "yaml",
|
||||
}, commandkit.Streams{Out: &output, Err: io.Discard})
|
||||
if outcome.Kind != commandkit.OutcomeSuccess || outcome.Status != 0 || validateCalls != 1 {
|
||||
t.Fatalf("validation outcome = (%#v, %q), calls=%d", outcome, output.String(), validateCalls)
|
||||
}
|
||||
if received.Selection != wantSelection || received.Request.PromptID != "briefing" || received.Request.PromptVersion != "v2" || received.Request.ProfileID != "editorial" || received.Request.SessionID != "session-1" {
|
||||
if received.Selection != wantSelection || received.Request.PromptID != "briefing" || received.Request.ProfileID != "editorial" || received.Request.SessionID != "session-1" {
|
||||
t.Errorf("validation request = %#v", received)
|
||||
}
|
||||
if received.Request.Vars["topic"] != "roadmap" || len(received.Request.Vars) != 1 {
|
||||
@@ -197,7 +197,7 @@ func TestValidationCommandPreservesPresenceAndRepeatedAssignmentsPerInvocation(t
|
||||
|
||||
firstArgs := []string{
|
||||
"promptkit", "requirements", "validate", "briefing", "--config", "", "--overlay", "",
|
||||
"--version", "", "--profile", "", "--session-id", "", "--campaign", "spring",
|
||||
"--profile", "", "--session-id", "", "--campaign", "spring",
|
||||
"--var", "=", "--var", "phrase= two words, three ", "--var", "duplicate=first", "--var", "duplicate=last=value",
|
||||
"--input", "=", "--input", "file= path, with commas=and=equals ", "--input", "duplicate=first.txt", "--input", "duplicate=last=path.txt",
|
||||
}
|
||||
@@ -209,7 +209,7 @@ func TestValidationCommandPreservesPresenceAndRepeatedAssignmentsPerInvocation(t
|
||||
if first.Selection.Config.Value != "" || !first.Selection.Config.Set || first.Selection.Overlay.Value != "" || !first.Selection.Overlay.Set {
|
||||
t.Errorf("explicit empty selection = %#v", first.Selection)
|
||||
}
|
||||
if first.Request.PromptVersion != "" || first.Request.ProfileID != "" || first.Request.SessionID != "" {
|
||||
if first.Request.PromptID != "briefing" || first.Request.ProfileID != "" || first.Request.SessionID != "" {
|
||||
t.Errorf("empty scalar values = %#v", first.Request)
|
||||
}
|
||||
wantVars := map[string]string{"": "", "phrase": " two words, three ", "duplicate": "last=value"}
|
||||
@@ -233,7 +233,7 @@ func TestValidationCommandPreservesPresenceAndRepeatedAssignmentsPerInvocation(t
|
||||
t.Fatalf("second invocation = %#v, requests=%d", outcome, len(requests))
|
||||
}
|
||||
second := requests[1]
|
||||
if second.Selection.Config.Set || second.Selection.Overlay.Set || second.Request.PromptVersion != "" || second.Request.ProfileID != "" || second.Request.SessionID != "" || len(second.Request.Vars) != 0 || len(second.Request.Inputs) != 0 {
|
||||
if second.Selection.Config.Set || second.Selection.Overlay.Set || second.Request.PromptID != "briefing" || second.Request.ProfileID != "" || second.Request.SessionID != "" || len(second.Request.Vars) != 0 || len(second.Request.Inputs) != 0 {
|
||||
t.Errorf("first invocation values leaked into second request: %#v", second)
|
||||
}
|
||||
if selectedInputs[1].campaign.Set || selectedInputs[1].campaign.Value != "" {
|
||||
@@ -256,6 +256,7 @@ func TestValidationCommandUsageAndInputFailuresStopProviderWork(t *testing.T) {
|
||||
{name: "extra operand", args: []string{"promptkit", "requirements", "validate", "briefing", "extra", "--campaign", "spring"}},
|
||||
{name: "unsupported format", args: []string{"promptkit", "requirements", "validate", "briefing", "--campaign", "spring", "--format", "text"}},
|
||||
{name: "unknown flag", args: []string{"promptkit", "requirements", "validate", "briefing", "--campaign", "spring", "--unknown", "value"}},
|
||||
{name: "removed prompt version flag", args: []string{"promptkit", "requirements", "validate", "briefing", "--campaign", "spring", "--version", "2"}},
|
||||
{name: "malformed variable before valid assignment", args: []string{"promptkit", "requirements", "validate", "briefing", "--campaign", "spring", "--var", "broken", "--var", "mode=full"}},
|
||||
{name: "malformed input before valid assignment", args: []string{"promptkit", "requirements", "validate", "briefing", "--campaign", "spring", "--input", "broken", "--input", "notes=file.txt"}},
|
||||
{name: "missing required selector", args: []string{"promptkit", "requirements", "validate", "briefing"}},
|
||||
|
||||
Reference in New Issue
Block a user