Files
Kontrollverlust/internal/account/handle_test.go
T
irrlichtandClaude Fable 5.1 a4a31cbc64 Schema: Ist-Stand statt Migrationskette, Umstellungscode entfernt
Es gibt genau eine Datenbank, die laufend mit dem Code mitgezogen wird
(Rolling Release). schema.sql beschreibt deshalb jetzt den aktuellen
Stand (Vorlage: Dump vom 22.11.2026) ohne DO-Block, ADD COLUMN IF NOT
EXISTS und Umbenennungen; auf der bestehenden DB sind alle Anweisungen
No-ops, eine frische bekommt dasselbe Schema.

Dazu fliegt der Code, der nur die Umstellung getragen hat: die
Handle-Umschrift (MigrateHandles, HandleFrom, freeHandle samt
go-unidecode) und der Hashtag-Backfill beim Start. kver handles und
legacy_name bleiben, bis alle Betroffenen ihren neuen Handle kennen.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-22 13:16:23 +01:00

37 lines
922 B
Go
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package account
import (
"strings"
"testing"
)
func TestValidHandle(t *testing.T) {
t.Parallel()
for in, want := range map[string]bool{
"alice": true, "a_1": true, strings.Repeat("a", 20): true,
"ab": false, strings.Repeat("a", 21): false, "Alice": false, "a.b": false, "jörg": false,
} {
if got := ValidHandle(in); got != want {
t.Errorf("ValidHandle(%q) = %v", in, got)
}
}
if got := NormalizeHandle(" @Alice "); got != "alice" {
t.Errorf("NormalizeHandle = %q", got)
}
}
func TestCleanDisplayName(t *testing.T) {
t.Parallel()
tests := []struct{ in, want string }{
{" Max Mustermann ", "Max Mustermann"},
{"Jörg 🌻", "Jörg 🌻"},
{"a​b\x07c", "abc"},
{strings.Repeat("ä", 40), strings.Repeat("ä", 32)},
}
for _, tt := range tests {
if got := CleanDisplayName(tt.in); got != tt.want {
t.Errorf("CleanDisplayName(%q) = %q, erwartet %q", tt.in, got, tt.want)
}
}
}