8bc79f3c38
Built from the Claude Design "VYNDR Player Intelligence" bundle (10 sections). - Archetypes: src/services/archetypeService.js — 41 archetypes (15 NBA / 5 WNBA-unique / 15 MLB / 6 soccer), classify -> primary+secondary+blend. Frontend visual map web/src/lib/archetypes.js (colors verified == backend). ArchetypeBadge (full/ghost/tint + glyphs) + ArchetypeBlend (DNA bar). - StatStrip (compact/expanded): player name once, horizontal mono stats, inline GradeBadge props, onPlayerClick -> profile. - Stats API: extended src/routes/stats.js with /player/:name, /leaders, /game/:id (rate-limited). Aggregation in playerIntelService.js (sanitizes name param; grades cache; graceful on cold cache). Next proxies added. - Player Profile /player/[name]: all 9 design sections, graceful empty states. - Enhanced GameCard (MLB pitchers + player-grouped StatStrips) + GradeResultCard (archetype strip + stat context + VYNDR intelligence, optional/self-hiding via gradeAdapter.buildIntelFields). Player-name links wired everywhere. - Settings page replaces the S41 redirect (account/subscription/notifications/ display/responsible-play/danger-zone with DELETE-gated delete). LINKS to the real /settings/security MFA page — does not replace it. + BookChip. - Bonus: Stats Explorer /explore (real /api/stats/leaders leaderboard); added Explore + Settings to Nav MORE. Deferred (need data pipelines, Session 43): Team Hub, Offseason Intel, Slate redesign, Stats Explorer sub-panels. Backend 1940 -> 2011 tests (+71), 157 suites. Web build clean (exit 0). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
67 lines
2.2 KiB
JavaScript
67 lines
2.2 KiB
JavaScript
// Session 42 — Settings page + BookChip.
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const WEB = path.join(__dirname, '..', '..', 'web', 'src');
|
|
const read = (rel) => fs.readFileSync(path.join(WEB, rel), 'utf8');
|
|
const { bookInfo } = require('../../web/src/lib/books');
|
|
|
|
describe('books lib (BookChip data)', () => {
|
|
it('maps known books to brand colors (case-insensitive aliases)', () => {
|
|
expect(bookInfo('DK')).toMatchObject({ name: 'DraftKings', fg: '#53D337' });
|
|
expect(bookInfo('draftkings').mono).toBe('DK');
|
|
expect(bookInfo('ESPN').mono).toBe('EB');
|
|
});
|
|
it('degrades unknown books to a neutral chip', () => {
|
|
const b = bookInfo('ZZZ');
|
|
expect(b.mono).toBe('ZZZ');
|
|
expect(b.fg).toBe('#B8BCC8');
|
|
});
|
|
});
|
|
|
|
describe('Settings page', () => {
|
|
const src = read('app/settings/page.tsx');
|
|
|
|
it('is a real page now (not a redirect)', () => {
|
|
expect(src).not.toContain("redirect('/profile')");
|
|
expect(src).toContain("'use client'");
|
|
});
|
|
|
|
it('renders the design sections', () => {
|
|
for (const label of ['ACCOUNT', 'SUBSCRIPTION', 'NOTIFICATIONS', 'DISPLAY PREFERENCES', 'RESPONSIBLE PLAY', 'DANGER ZONE']) {
|
|
expect(src).toContain(label);
|
|
}
|
|
});
|
|
|
|
it('reads the plan tier from useAuth (consistent with nav/profile)', () => {
|
|
expect(src).toContain('useAuth()');
|
|
expect(src).toContain('tierLabel');
|
|
});
|
|
|
|
it('LINKS to /settings/security (does NOT replace the MFA page)', () => {
|
|
expect(src).toContain('href="/settings/security"');
|
|
});
|
|
|
|
it('danger zone delete button is gated on typing DELETE exactly', () => {
|
|
expect(src).toContain("deleteText === 'DELETE'");
|
|
expect(src).toContain('disabled={!canDelete');
|
|
});
|
|
|
|
it('opens the existing Preferences modal via window.__prefs', () => {
|
|
expect(src).toContain('window.__prefs');
|
|
});
|
|
|
|
it('does not fake account-deletion success', () => {
|
|
// On a non-ok response we surface an honest message, not a success.
|
|
expect(src).toContain('could not be completed');
|
|
});
|
|
});
|
|
|
|
describe('BookChip.tsx', () => {
|
|
const src = read('components/vyndr/BookChip.tsx');
|
|
it('renders a mono tile from the books lib', () => {
|
|
expect(src).toContain('bookInfo');
|
|
expect(src).toContain('className="mono"');
|
|
});
|
|
});
|