package config import ( "maps" "testing" ) // TestWithOrgModelsKeepsAliasesTheOrgDoesNotOverride pins that an org's absent // aliases are not an empty model set for the system org, while any other org // gets only what its policy resolved, and defined aliases replace them outright. func TestWithOrgModelsKeepsAliasesTheOrgDoesNotOverride(t *testing.T) { instance := map[string]string{"default": "a/large", "embedding": "b/embed"} tests := []struct { name string org OrgModels want map[string]string }{ {"the system org with no stored aliases keeps the instance's", OrgModels{}, instance}, {"another org resolving no aliases gets none", OrgModels{Org: "acme"}, nil}, {"an org's own aliases replace the instance's", OrgModels{Aliases: map[string]string{"fast": "c/small"}}, map[string]string{"fast": "c/small"}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { models := Config{Models: instance}.WithOrgModels(tt.org).Models if !maps.Equal(models, tt.want) { t.Fatalf("models = %v, want %v", models, tt.want) } }) } }