feat(account): give a fresh guest a distinct "Guest######" display name

Every guest showed a bare "Guest" to opponents (e.g. in a random match). Mint the display name
as "Guest" + a random six-digit suffix at provisioning, so guests are distinguishable. Not an
identifier and not unique — a label only, so collisions are harmless.
This commit is contained in:
Ilia Denisov
2026-07-15 02:17:13 +02:00
parent 896b7f57a7
commit 74026223ee
2 changed files with 14 additions and 3 deletions
+5
View File
@@ -5,6 +5,7 @@ package inttest
import (
"context"
"errors"
"regexp"
"testing"
"time"
@@ -241,6 +242,10 @@ func TestProvisionSeedsTimeZone(t *testing.T) {
if guest.PreferredLanguage != "ru" {
t.Errorf("guest PreferredLanguage = %q, want the seeded ru", guest.PreferredLanguage)
}
// A guest's display name is "Guest" + a random six-digit suffix (distinct to opponents).
if m, _ := regexp.MatchString(`^Guest\d{6}$`, guest.DisplayName); !m {
t.Errorf("guest DisplayName = %q, want Guest + 6 digits", guest.DisplayName)
}
plainGuest, err := store.ProvisionGuest(ctx, "", "")
if err != nil {
t.Fatalf("provision plain guest: %v", err)