Files
vyndr/tests/unit/vyndrMobile.test.js
T
builtbykev c8790fde55 Session 57: Phase 0 — Kill the Lies (2309 tests)
Work-order Phase 0 (Jul 10 live audit): every fabricated UI element deleted
or rewired to real data. Deletion sprint — no new product features.

0.1 Fake NBA game: root cause was scheduleService fetching the ESPN
    scoreboard with no ?dates= param or date filter — off-season ESPN
    returns the NEAREST slate (Jun 13 NYK@SA Finals rendered as tonight).
    Now pinned to the requested ET date + defensive filter; undated events
    dropped. Honest month-aware per-sport empty states (lib/emptyState.js).
0.2 Fake header counters: liveTick stripped to a bare 1s pulse (the
    auto-incrementing "247 graded", sin-driven brain-%, aPlus/cascades are
    dead). New GET /api/snapshot/summary (cache-only, before /:sport) +
    Next proxy; HeartbeatBar shows the real graded count and SYNC =
    elapsed since the last pipeline run (amber past 5 min).
0.3 Ticker: hardcoded fallback items deleted (real snapshot exhaust only);
    MOVE kept — computeLineDeltas is real movement. <4 real items → no
    ticker; bar publishes --ticker-h so the fixed header collapses cleanly.
0.4 /terminal retired: route redirects to /dashboard; VVI/injury-wire/
    leaders layouts preserved unrouted as §12 content-engine templates.
    Nav PRIMARY = Slate/Scan/Ledger; BottomTabBar Terminal→Explore; PWA
    shortcut Terminal→Ledger; #terminal alias → /dashboard.
0.5 ›Query nav pill deleted (duplicate /scan link).

Backend 2289 → 2309 tests (199 suites), web build exit 0.
Spec: specs/phase-0-kill-the-lies.md. Next: work-order Phase 1 (ledger
persistence + settlement).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 20:17:49 -04:00

113 lines
4.5 KiB
JavaScript

// VYNDR 2.0 — Phase F mobile parity (Session 37): 5-tab bar, More sheet,
// mobile CSS, PWA manifest/viewport. The manifest is required as JSON; the
// .tsx/.css are asserted against source text (plain-JS Jest, no transform).
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 manifest = require('../../web/public/manifest.json');
describe('Phase F — BottomTabBar (5-tab spec)', () => {
const src = read('components/BottomTabBar.tsx');
// Session 57 (Phase 0) — Terminal tab retired (fabricated surface);
// Explore holds its slot so the bar keeps 5 tabs.
it('renders the five spec tabs', () => {
['Slate', 'Explore', 'Scan', 'Ledger', 'More'].forEach((label) => {
expect(src).toContain(`'${label}'`);
});
});
it('routes the primary tabs to real pages', () => {
['/dashboard', '/explore', '/scan', '/ledger'].forEach((href) => expect(src).toContain(href));
});
it('does not link the retired /terminal surface', () => {
expect(src).not.toContain('/terminal');
});
it('makes Scan the prominent (primary) action in grade-green', () => {
expect(src).toContain('primary: true');
expect(src).toContain("background: 'var(--g-a)'");
});
it('marks the active tab grade-green, inactive faint', () => {
expect(src).toContain("'var(--g-a)'");
expect(src).toContain("'var(--text-2)'");
});
it('respects the iOS safe area', () => {
expect(src).toContain('env(safe-area-inset-bottom');
});
it('uses the mobile-only class so it hides on desktop', () => {
expect(src).toContain("className=\"mobile-tab-bar\"");
});
});
describe('Phase F — More bottom sheet', () => {
const src = read('components/BottomTabBar.tsx');
it('lists the secondary routes', () => {
['/compare', '/tracker', '/blog', '/invite', '/pricing', '/account', '/help', '/about', '/responsible-gambling'].forEach((href) =>
expect(src).toContain(href),
);
});
it('slides up with a dismissible backdrop', () => {
expect(src).toContain('sheet-up');
expect(src).toContain('rgba(6,6,11,.6)'); // backdrop
expect(src).toContain('onClick={() => setMoreOpen(false)}'); // tap-to-dismiss
});
it('gives sheet items a ≥44px touch target', () => {
expect(src).toContain('minHeight: 48');
});
});
describe('Phase F — mobile CSS (globals.css)', () => {
const css = read('app/globals.css');
it('hides the tab bar at the desktop breakpoint', () => {
expect(css).toMatch(/@media \(min-width: 768px\)[\s\S]*?\.mobile-tab-bar \{ display: none/);
});
it('pads main for the bottom bar on mobile with safe-area', () => {
expect(css).toMatch(/@media \(max-width: 767px\)/);
expect(css).toContain('env(safe-area-inset-bottom, 0px)');
});
it('shrinks the grade hero and stacks the terminal grid on mobile', () => {
expect(css).toContain('.grade-hero { font-size: 80px');
expect(css).toContain('.terminal-grid { grid-template-columns: 1fr');
});
it('enables horizontal scroll for book tables', () => {
expect(css).toContain('.game-lines-grid');
expect(css).toContain('overflow-x: auto');
});
});
describe('Phase F — Nav mobile header', () => {
it('retires the hamburger on mobile (tab bar owns nav)', () => {
const src = read('components/Nav.tsx');
expect(src).toMatch(/nav-mobile-toggle[\s\S]*?display: 'none'/);
});
});
describe('Phase F — GradeResultCard mobile hook', () => {
it('tags the grade letter with the grade-hero class', () => {
expect(read('components/vyndr/GradeResultCard.tsx')).toContain('grade-hero');
});
});
describe('Phase F — PWA manifest + viewport (§11)', () => {
it('is a standalone PWA themed to the void', () => {
expect(manifest.display).toBe('standalone');
expect(manifest.theme_color.toLowerCase()).toBe('#06060b');
expect(manifest.background_color.toLowerCase()).toBe('#06060b');
});
it('ships deep-link shortcuts for Slate / Scan / Ledger', () => {
const urls = (manifest.shortcuts || []).map((s) => s.url);
expect(urls).toContain('/dashboard');
expect(urls).toContain('/scan');
expect(urls).toContain('/ledger');
expect(urls).not.toContain('/terminal'); // retired (Session 57, Phase 0)
});
it('declares its categories', () => {
expect(manifest.categories).toContain('sports');
expect(manifest.categories).toContain('productivity');
});
it('sets viewport-fit=cover for the notch', () => {
expect(read('app/layout.tsx')).toContain("viewportFit: 'cover'");
});
});