18 lines
437 B
Go
18 lines
437 B
Go
package identity
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func TestStableIDIsRFC4122(t *testing.T) {
|
|
for _, name := range []string{"agent", "operator", "archie", "Some Bot", ""} {
|
|
got := string(StableID(name))
|
|
id, err := uuid.Parse(got)
|
|
if err != nil || id.String() != got || id.Version() != 5 || id.Variant() != uuid.RFC4122 {
|
|
t.Errorf("StableID(%q) = %q, not an RFC 4122 v5 UUID (err %v)", name, got, err)
|
|
}
|
|
}
|
|
}
|