package config import ( "maps" "testing" ) // TestWithOrgModelsKeepsAliasesTheOrgDoesNotOverride pins that an org's absent // aliases are not an empty model set: a run keeps the aliases it already // resolved, and an org that does define aliases replaces 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 }{ {"an org with no aliases of its own keeps the instance's", OrgModels{}, instance}, {"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) } }) } }