Files
vyndr/tests/unit/pipelineSchedule.test.js
T
builtbykev d10bb4cce2 Session 59: Addendum + work-order 1.6 + Phase 2 + Phase 3 (2352 tests)
Overnight sprint for the Saturday 10 AM ET deploy gate — day one of the
public ledger record locks against freshly posted lines.

Task A — ledger team/opponent (migration 020, applied at 0 rows):
  populated in both write paths from the real feed; opponent only when the
  player's team matches a game participant (never guessed). Roadmap: Phase
  4.5 WNBA ESPN-boxscore settlement (due ~Jul 24) + Phase 5 per-tier
  calibration logged.

Task B — work-order 1.6 CLOSED (canonical player keys):
  - searchPlayer resolves via nameKey; the old matcher deleted accents
    ("Sanchez" with acute -> "snchez") and substring-guessed onto the WRONG
    player (the mismatched last-10 bug). Ambiguous -> null, never guess.
  - Slate JOIN INVARIANT: a graded prop whose player's real team isn't in
    the game is dropped (TB player can't render under MIL@PIT) — locked by
    tests that fail the suite on regression.
  - grades:{sport} TTL 2h -> 6h (expired between 5h cron gaps — the real
    cause of /team "No active props" for slate players).

Task C — Phase 2 slate UX: tabs are THE filter (URL ?sport=, deep-linkable,
  duplicate legacy tablist removed); cards cap at 6 graded props sorted
  A+->F with ALL N READS in-place expander; waiting states show the real
  next pipeline run ("Grades post ~6:00 PM ET").

Task D — Phase 3 mobile P0: root cause of vanished 390px nav was HIDE_ON
  including '/' (landing had zero navigation) — fixed; html/body overflow-x
  contained; GAME LINES collapses to best-line summary + "N BOOKS" expander
  below 640px; venue drops before time/pitchers ever truncate.

Live verification: raw ESPN today STILL returns the Jun 13 NYK@SA Finals
game without a date pin; the pinned fetch returns 0 games, 0 off-date.

Backend 2327 -> 2352 tests (202 suites), web build exit 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 22:24:47 -04:00

29 lines
1.2 KiB
JavaScript

// Session 59 (work-order 2.3) — honest waiting states derive from the REAL
// cron schedule (UTC 14,19,22,1,3). A wrong time is a lie; keep HOURS_UTC in
// sync with snapshotScheduler's default.
const { HOURS_UTC, nextRunAt, nextRunLabelET } = require('../../web/src/lib/pipelineSchedule');
const { HOURS_UTC: BACKEND_HOURS } = require('../../src/snapshotScheduler');
describe('pipelineSchedule', () => {
test('mirrors the backend default cron hours EXACTLY', () => {
expect([...HOURS_UTC].sort((a, b) => a - b)).toEqual([...BACKEND_HOURS].sort((a, b) => a - b));
});
test('next run after 15:30 UTC is 19:00 UTC same day', () => {
const now = new Date('2026-07-10T15:30:00Z');
expect(nextRunAt(now).toISOString()).toBe('2026-07-10T19:00:00.000Z');
});
test('next run after 23:30 UTC rolls to 01:00 UTC next day', () => {
const now = new Date('2026-07-10T23:30:00Z');
expect(nextRunAt(now).toISOString()).toBe('2026-07-11T01:00:00.000Z');
});
test('label renders an ET clock time', () => {
// 19:00 UTC = 3:00 PM ET in July (EDT).
const label = nextRunLabelET(new Date('2026-07-10T15:30:00Z'));
expect(label).toBe('~3:00 PM ET');
});
});