Consolidate bundled catalog test expectations
This commit is contained in:
@@ -2,8 +2,8 @@ package promptkit_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"reflect"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"go.maximumdirect.net/configkit"
|
||||
@@ -58,11 +58,10 @@ func TestBundledCompositionReplacementAndInheritance(t *testing.T) {
|
||||
if target := inspect("openrouter/profile"); target.BackendID != "openrouter/local" || target.Model != "collection-model" {
|
||||
t.Fatalf("collection = %+v", target)
|
||||
}
|
||||
for _, tier := range []string{"low", "medium", "high", "xhigh", "max"} {
|
||||
target := inspect("auto-" + tier)
|
||||
if target.BackendID != "other" || target.Model != "other-model" || !strings.Contains(fmt.Sprint(target.ExtraParams), "cost_tier:"+tier) || !strings.Contains(fmt.Sprint(target.ExtraParams), "id:auto-router") {
|
||||
t.Errorf("tier %s = %+v", tier, target)
|
||||
}
|
||||
target := inspect("auto-low")
|
||||
wantPlugins := map[string]any{"plugins": []any{map[string]any{"id": "auto-router", "cost_tier": "low"}}}
|
||||
if target.BackendID != "other" || target.Model != "other-model" || !reflect.DeepEqual(target.ExtraParams, wantPlugins) {
|
||||
t.Errorf("inherited tier = %+v", target)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,11 +69,11 @@ func TestBundledCompositionSequenceModes(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name, mode, id string
|
||||
wantErr bool
|
||||
count int
|
||||
hasAuto bool
|
||||
}{
|
||||
{"duplicate append", "append", "auto", true, 0},
|
||||
{"distinct append", "append", "custom", false, 18},
|
||||
{"replace", "replace", "custom", false, 1},
|
||||
{"duplicate append", "append", "auto", true, false},
|
||||
{"distinct append", "append", "custom", false, true},
|
||||
{"replace", "replace", "custom", false, false},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
input := configkit.Input{Source: configkit.Mapping("sequence", map[string]any{
|
||||
@@ -92,7 +91,7 @@ func TestBundledCompositionSequenceModes(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
profiles, err := engine.ListProfiles(context.Background())
|
||||
if err != nil || len(profiles) != test.count {
|
||||
if err != nil || !slices.Contains(profiles, "custom") || slices.Contains(profiles, "auto") != test.hasAuto {
|
||||
t.Fatalf("profiles = %v, %v", profiles, err)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user