mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
26 lines
845 B
Go
26 lines
845 B
Go
// Copyright 2026 Hanzo AI, Inc.
|
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
|
|
package schema
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestOrgDisplayName(t *testing.T) {
|
|
for _, bad := range []string{
|
|
"Acme\u202eeVIL", "Ac\u200bme", "Acme\u2066x\u2069", "\ufeffAcme", "Ac\nme",
|
|
"Ac\u2028me", "Ac\u2029me", "\u3164", "Acme\u3164", "\u2800", "Ac\u115fme", "\u034f", "\ufe0f", "\U000e0100", "\u17b4", "\u180b", "\u2065", "Ac\U000f0000me", strings.Repeat("a", MaxOrgDisplayName+1),
|
|
} {
|
|
if _, err := OrgDisplayName(bad); err == nil {
|
|
t.Errorf("%q must be refused", bad)
|
|
}
|
|
}
|
|
for in, want := range map[string]string{" Acme Rockets ": "Acme Rockets", "Société Générale": "Société Générale", "": ""} {
|
|
if got, err := OrgDisplayName(in); err != nil || got != want {
|
|
t.Errorf("%q = %q %v, want %q", in, got, err, want)
|
|
}
|
|
}
|
|
}
|