Separate comparison side selectors
This commit is contained in:
@@ -64,7 +64,7 @@ func TestPublicConfigDiffUsesPromptKitPairAndPreparedInputs(t *testing.T) {
|
||||
events = append(events, "state")
|
||||
return &compositionState{token: len(events)}
|
||||
},
|
||||
Selectors: []ckconfig.Selector[*compositionInput]{{Binding: flag, Scopes: []string{"app", "promptkit"}}},
|
||||
Selectors: []ckconfig.Selector[*compositionInput]{{Binding: flag, AgainstName: "against-campaign", Scopes: []string{"app", "promptkit"}}},
|
||||
CheckInput: func(scope string, selection ckconfig.Selection, input *compositionInput) error {
|
||||
if scope == "promptkit" {
|
||||
events = append(events, "check")
|
||||
@@ -90,7 +90,7 @@ func TestPublicConfigDiffUsesPromptKitPairAndPreparedInputs(t *testing.T) {
|
||||
rightSet bool
|
||||
}{
|
||||
{name: "right selection is explicit", rightArgs: []string{"--against-config", "after.yml"}, rightValue: "after.yml", rightSet: true},
|
||||
{name: "right selection inherits", rightValue: "before.yml", rightSet: true},
|
||||
{name: "right selection remains omitted"},
|
||||
{name: "empty right selection is supplied", rightArgs: []string{"--against-config", ""}, rightSet: true},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
@@ -100,7 +100,7 @@ func TestPublicConfigDiffUsesPromptKitPairAndPreparedInputs(t *testing.T) {
|
||||
loadedInputs = nil
|
||||
loadedStates = nil
|
||||
loadedSelections = nil
|
||||
args := []string{"config", "diff", "--scope", "promptkit", "--config", "before.yml", "--campaign", "spring"}
|
||||
args := []string{"config", "diff", "--scope", "promptkit", "--config", "before.yml", "--campaign", "spring", "--against-campaign", "spring"}
|
||||
args = append(args, test.rightArgs...)
|
||||
var output bytes.Buffer
|
||||
outcome := app.Execute(context.Background(), args, commandkit.Streams{Out: &output, Err: io.Discard})
|
||||
@@ -153,7 +153,7 @@ func TestPublicConfigDiffUsesPromptKitPairAndPreparedInputs(t *testing.T) {
|
||||
}
|
||||
|
||||
var diagnostics bytes.Buffer
|
||||
failure := app.Execute(context.Background(), []string{"config", "diff", "--scope", "promptkit", "--config", "bad-left.yml", "--against-config", "right.yml", "--campaign", "spring"}, commandkit.Streams{Out: io.Discard, Err: &diagnostics})
|
||||
failure := app.Execute(context.Background(), []string{"config", "diff", "--scope", "promptkit", "--config", "bad-left.yml", "--against-config", "right.yml", "--campaign", "spring", "--against-campaign", "spring"}, commandkit.Streams{Out: io.Discard, Err: &diagnostics})
|
||||
if failure.Kind != commandkit.OutcomeOperational || !strings.Contains(diagnostics.String(), `Configuration scope "promptkit" (left):`) {
|
||||
t.Fatalf("installed load failure = %#v, diagnostics %q", failure, diagnostics.String())
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ go run . config scopes
|
||||
go run . config validate --scope all --campaign spring --limit=0
|
||||
go run . config diff --scope app --config fixtures/before.yml --against-config fixtures/after.yml
|
||||
go run . config diff --scope app --config fixtures/before.yml --against-config fixtures/after.yml --campaign spring --limit=0
|
||||
go run . config diff --scope promptkit --config fixtures/before.yml --against-config fixtures/after.yml --campaign spring
|
||||
go run . config diff --scope promptkit --config fixtures/before.yml --against-config fixtures/after.yml --campaign spring --against-campaign spring
|
||||
go run . promptkit list prompts --config fixtures/before.yml --campaign spring
|
||||
go run . promptkit list profiles --config fixtures/after.yml --campaign autumn --format yaml
|
||||
go run . promptkit list backends --campaign spring
|
||||
|
||||
@@ -234,8 +234,8 @@ func newAppWithEngineLoader(
|
||||
return nil
|
||||
},
|
||||
Selectors: []ckconfig.Selector[*inspectionInput]{
|
||||
{Binding: campaignSelector(), Scopes: []string{"app", "promptkit"}},
|
||||
{Binding: limitFlag, Scopes: []string{"app"}},
|
||||
{Binding: campaignSelector(), AgainstName: "against-campaign", Scopes: []string{"app", "promptkit"}},
|
||||
{Binding: limitFlag, AgainstName: "against-limit", Scopes: []string{"app"}},
|
||||
},
|
||||
Scopes: []ckconfig.Scope[*inspectionInput, *runCache]{appScope, engineScope},
|
||||
})
|
||||
|
||||
@@ -297,7 +297,7 @@ func TestPromptKitScopeDiffAndCatalogsUseSelectedCampaign(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var output bytes.Buffer
|
||||
outcome := app.Execute(context.Background(), []string{"config", "diff", "--scope", "promptkit", "--config", "fixtures/before.yml", "--against-config", "fixtures/after.yml", "--campaign", "spring"}, commandkit.Streams{Out: &output, Err: io.Discard})
|
||||
outcome := app.Execute(context.Background(), []string{"config", "diff", "--scope", "promptkit", "--config", "fixtures/before.yml", "--against-config", "fixtures/after.yml", "--campaign", "spring", "--against-campaign", "spring"}, commandkit.Streams{Out: &output, Err: io.Discard})
|
||||
if outcome.Kind != commandkit.OutcomeSuccess {
|
||||
t.Fatalf("PromptKit diff outcome = %#v", outcome)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user