Files
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

60 lines
2.1 KiB
Go

package modelcatalog
import (
"reflect"
"testing"
)
func TestProjectComposerCatalogPreservesSelectedModelCapabilities(t *testing.T) {
models := []ModelOption{
{
ID: "gpt-5.6",
IsDefault: true,
ReasoningEffortsAdvertised: true,
DefaultReasoningEffort: "high",
SupportedReasoningEfforts: []ReasoningEffortOption{
{Value: "low"}, {Value: "medium"}, {Value: "high"},
{Value: "xhigh"}, {Value: "max"}, {Value: "ultra"},
},
SpeedsAdvertised: true,
DefaultSpeed: "standard",
SupportedSpeeds: []SpeedOption{{Value: "standard"}, {Value: "fast"}},
},
}
projection := ProjectComposerCatalog(models, "")
if !projection.Selection.Found || projection.Selection.Model.ID != "gpt-5.6" {
t.Fatalf("selection = %#v", projection.Selection)
}
if projection.Selection.DefaultSpeed != "standard" {
t.Fatalf("default speed = %q, want standard", projection.Selection.DefaultSpeed)
}
wantReasoning := []string{"low", "medium", "high", "xhigh", "max", "ultra"}
gotReasoning := make([]string, 0, len(projection.Selection.ReasoningEfforts))
for _, option := range projection.Selection.ReasoningEfforts {
gotReasoning = append(gotReasoning, option.Value)
}
if !reflect.DeepEqual(gotReasoning, wantReasoning) {
t.Fatalf("reasoning = %#v, want %#v", gotReasoning, wantReasoning)
}
profile := projection.ReasoningOptionsByModel["gpt-5.6"]
if profile.DefaultValue != "high" || len(profile.Options) != len(wantReasoning) {
t.Fatalf("reasoning profile = %#v", profile)
}
}
func TestProjectComposerCatalogPreservesAdvertisedEmptyCapabilities(t *testing.T) {
projection := ProjectComposerCatalog([]ModelOption{{
ID: "catalog-owned",
ReasoningEffortsAdvertised: true,
}}, "catalog-owned")
profile, found := projection.ReasoningOptionsByModel["catalog-owned"]
if !found || len(profile.Options) != 0 || profile.DefaultValue != "" {
t.Fatalf("profile = %#v, found=%v", profile, found)
}
if !projection.Selection.ReasoningEffortsAdvertised || len(projection.Selection.ReasoningEfforts) != 0 {
t.Fatalf("selection = %#v", projection.Selection)
}
}