mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-06-10 06:10:46 +00:00
f3f4c67b36
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>
30 lines
625 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|