Files

36 lines
753 B
Go
Raw Permalink Normal View History

2026-08-17 00:39:25 +02:00
package auth
import (
2026-08-17 21:20:45 +02:00
"strings"
2026-08-17 00:39:25 +02:00
"testing"
)
func TestOwnershipErrorClientFacing(t *testing.T) {
t.Parallel()
for _, err := range []error{
ErrNotCompanyOwner,
ErrCannotRemoveOwner,
ErrTransferSelf,
ErrOwnerRequired,
} {
msg, ok := ClientError(err)
if !ok || msg == "" {
t.Fatalf("expected client error for %v", err)
}
}
}
2026-08-17 21:20:45 +02:00
func TestClientError_syntheticEmailPublicString(t *testing.T) {
t.Parallel()
msg, ok := ClientError(ErrSyntheticEmail)
if !ok {
t.Fatal("ErrSyntheticEmail should be a client error")
}
if msg != "this email cannot receive invites" {
t.Fatalf("public msg=%q", msg)
}
if strings.Contains(msg, "synthetic") || strings.Contains(msg, "migration") {
t.Fatalf("internal wording leaked: %q", msg)
}
}