easyai-ai-gateway/apps/api/internal/store/api_key_scopes_test.go

15 lines
358 B
Go

package store
import (
"reflect"
"testing"
)
func TestNormalizeAPIKeyScopes(t *testing.T) {
got := normalizeAPIKeyScopes([]string{" Chat ", "AUDIO", "", "chat", "*", "all", " text_to_speech "})
want := []string{"chat", "audio", "all", "text_to_speech"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("normalize scopes = %#v, want %#v", got, want)
}
}