Files
goclaw/internal/store/validate_test.go
T
Viet Tran f3f4c67b36 Initial commit: GoClaw AI agent gateway
Multi-agent AI gateway with WebSocket RPC, HTTP API, and messaging channel integrations.
Go port of OpenClaw with multi-tenant PostgreSQL, per-user isolation, security hardening,
and production observability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:58:07 +07:00

30 lines
625 B
Go

package store
import (
"strings"
"testing"
)
func TestValidateUserID(t *testing.T) {
tests := []struct {
name string
id string
wantErr bool
}{
{"empty", "", false},
{"normal", "user@example.com", false},
{"max_length", strings.Repeat("a", 255), false},
{"too_long", strings.Repeat("a", 256), true},
{"way_too_long", strings.Repeat("x", 1000), true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
err := ValidateUserID(tt.id)
if (err != nil) != tt.wantErr {
t.Errorf("ValidateUserID(%d chars) error = %v, wantErr %v", len(tt.id), err, tt.wantErr)
}
})
}
}