fix(07-04): make calendar populated-state test non-vacuous (BL-01) + deterministic seed window (BL-02)

Deep review found the calendar 'populated state' assertions were vacuous:
- getByText('Nothing here').toHaveCount(0) targeted CalendarShell's EmptyState,
  which CalendarShell NEVER renders (success branch always mounts ScheduleXCalendar;
  EmptyState.tsx is dead code, imported by nothing). The check was permanently green
  regardless of the seed — a regression dropping all events would have shipped green.
- .sx-react-calendar-wrapper renders on any successful auth, with or without events,
  so it never proved the seed reached the UI.

Replaced the dead-EmptyState check with a real DB→UI proof: assert the seeded event
title 'Seeded Test Event' is rendered in the grid. Verified non-vacuous — passes with
the seed on both profiles; with /api/events mocked to [] the title is absent (would fail).

BL-02: the seed anchored the event at now+24h. Both phone profiles render the
month-agenda view of the CURRENT month, so on a month's last day 'tomorrow' falls into
the next month and vanishes from the grid, making the new visibility assertion date-fragile.
Re-anchored to noon-today (UTC) — always today's local date, always in the current-month view.

Verified: full 58-test suite passes both profiles; typecheck clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Lucas Berger
2026-06-11 07:38:41 -04:00
co-authored by Claude Opus 4.8
parent f52b722b9b
commit 53c3ca56b8
2 changed files with 19 additions and 6 deletions
+9 -4
View File
@@ -67,14 +67,19 @@ test.describe('Rule 5 — populated calendar state', () => {
// The Schedule-X React adapter emits a div.sx-react-calendar-wrapper.
// Prefer a stable locator: the class name is documented in apps/pwa/src/styles/index.css.
// No semantic role exists for the widget wrapper, so CSS class is the documented fallback.
// NOTE: the wrapper renders on any successful auth — this proves the grid mounts, NOT that
// the seed reached the UI. The DB→UI proof is the separate "seeded event is rendered" test.
const calendarGrid = page.locator('.sx-react-calendar-wrapper')
await expect(calendarGrid).toBeVisible()
})
test('EmptyState "Nothing here" is NOT present when events are seeded', async ({ page }) => {
// CalendarShell renders EmptyState when the events query succeeds with zero occurrences.
// With the seeded event, EmptyState must not appear. Use toHaveCount(0) for strict absence.
await expect(page.getByText('Nothing here')).toHaveCount(0)
test('seeded event "Seeded Test Event" is rendered in the grid (DB→UI proof)', async ({ page }) => {
// The one assertion that actually proves the seeded row flows DB → API → query → grid.
// global-setup seeds a timed event titled 'Seeded Test Event' (noon today) on calendar 10.
// Schedule-X renders the event with its title text inside the grid. If the seed broke, the
// /api/events join regressed, or hydration dropped events, THIS fails (unlike a wrapper /
// dead-EmptyState check, which would stay green). Deep-review BL-01.
await expect(page.getByText('Seeded Test Event').first()).toBeVisible()
})
test('no horizontal overflow on populated /calendar (Rule 2)', async ({ page }) => {