f72f063e6f
Betting-logic audit: the CONSENSUS-vs-MODEL board flooded with fake reads like "DOUBLES u0.5 · MODEL 0.2 · +edge" — the juiced under side of rare counting-stat markets (doubles/triples/HR/SB), which is never a takeable edge and violates the no-unders-default doctrine. Report finding (item 3/4): the doubles projection is REAL per-player, not a flat fallback — 'doubles' maps to a real game-log field (MLB_LOG_FIELD doubles→ doubles) and the live values varied (0.03/0.16/0.2/0.22). So no projection-gate refusal for fakeness; the problem is purely structural (a rare event's real projection always sits below a 0.5 line, so the under always "wins"). Fix (config-driven — src/config/rareEventMarkets.js, tunable stat list + line threshold): - Grade layer (analyzeViaEngine1): a rare-event UNDER at ≤0.5 is always REFUSED (grade null + suppressed flag/reason). A rare-event OVER at ≤0.5 is refused UNLESS the model genuinely projects the event above the line — because a 0.2-over-0.5 carries the SAME |edge| as the suppressed under and would just take its rank on the board. The over grades normally once projection > line. - Board layer (marketBreadth.collectBreadth): drops null-model rows so a suppressed/ungraded prop can't rank a "MODEL —" placeholder onto the board. 10 suppression tests + config locks; also fixed a settingsPage book assertion left over from the ESPN→theScore swap. Suite 274/3289 green, web build exit 0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
68 lines
2.3 KiB
JavaScript
68 lines
2.3 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');
|
|
// ESPN BET retired → theScore Bet (PENN) successor (item 7).
|
|
expect(bookInfo('THESCORE')).toMatchObject({ name: 'theScore Bet', mono: 'TS' });
|
|
});
|
|
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"');
|
|
});
|
|
});
|