3b47b783dc
Name micro-fixes (close the normalization arc): - collapseInitials merges "J C Escarra" -> "JC Escarra" (display + key); both playerName.js copies. Added mickey:michael nickname. Onboarding flow (end-to-end, complete): - Storage: Supabase user_metadata.preferences (no migration). - API: src/routes/preferences.js GET/POST (requireAuth, admin getUserById/ updateUserById, partial merge + sanitize) + Next /api/preferences proxy. - Page: web onboarding/page.tsx — 3 steps (sports >=1 / books skip / bankroll presets+custom+skip) -> SIGNAL ACTIVE -> POST onboarding_complete:true -> 2s -> /dashboard. Redirects to login when unauthenticated. - Redirect: dashboard fetches /api/preferences fresh; new+incomplete users (created_at >= cutoff) -> /onboarding; never while auth loading; existing users exempt. - Personalization: Slate default tab = prefs.sports[0]; preferred books glow in the card lines grid (lib/books isPreferredBook, threaded dash->Slate->GameCard). - Settings: PREFERENCES section loads + edits + saves sports/books/limit. Backend 2156 -> 2185 tests (+29), 184 suites. Web build clean (exit 0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
// Session 49 — Phase 1: name micro-fixes (initials collapse + mickey nickname).
|
|
|
|
const be = require('../../src/utils/playerName');
|
|
const fe = require('../../web/src/lib/playerName');
|
|
|
|
describe('initials collapse', () => {
|
|
it('"J C Escarra" === "JC Escarra"', () => {
|
|
expect(be.nameKey('J C Escarra')).toBe(be.nameKey('JC Escarra'));
|
|
expect(be.normalizeName('J C Escarra').display).toBe('JC Escarra');
|
|
});
|
|
it('handles 3+ initials ("J C E Smith" → "JCE Smith")', () => {
|
|
expect(be.normalizeName('J C E Smith').display).toBe('JCE Smith');
|
|
});
|
|
it('does not collapse a single initial before a real word ("O Henry")', () => {
|
|
expect(be.normalizeName('O Henry').display).toBe('O Henry');
|
|
});
|
|
});
|
|
|
|
describe('mickey nickname', () => {
|
|
it('"Mickey Gasper" === "Michael Gasper"', () => {
|
|
expect(be.nameKey('Mickey Gasper')).toBe(be.nameKey('Michael Gasper'));
|
|
});
|
|
});
|
|
|
|
describe('frontend + backend copies agree', () => {
|
|
it.each(['J C Escarra', 'Mickey Gasper', 'J C E Smith', 'O Henry', 'Aaron Judge'])('%s', (n) => {
|
|
expect(fe.nameKey(n)).toBe(be.nameKey(n));
|
|
expect(fe.normalizeName(n).display).toBe(be.normalizeName(n).display);
|
|
});
|
|
});
|