package atp import ( "slices" "testing" ) func TestScopesForCollections(t *testing.T) { tests := []struct { name string collections []string want []string }{ { name: "no collections", collections: nil, want: []string{"atproto"}, }, { name: "multiple collections", collections: []string{"social.arabica.alpha.bean", "social.arabica.alpha.brew"}, want: []string{"atproto", "repo:social.arabica.alpha.bean", "repo:social.arabica.alpha.brew"}, }, } for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { got := ScopesForCollections(tc.collections...) if !slices.Equal(got, tc.want) { t.Fatalf("got %v, want %v", got, tc.want) } }) } } func TestScopesForCollections_ExtraScopes(t *testing.T) { got := ScopesForCollections("social.arabica.alpha.bean") got = append(got, "transition:generic") if len(got) != 3 { t.Fatalf("expected 3 scopes, got %d", len(got)) } }