Commit 296fc5c
test(website): keep upcoming-events coverage when nothing is scheduled (Comfy-Org#15160)
*PR Created by the Glary-Bot Agent*
---
## Summary
The "Upcoming events" list on `/events` is derived from the wall clock,
so it empties out once the newest configured event ends — which silently
reduced every assertion about those rows to a no-op. This restores that
coverage in a form that does not depend on the calendar.
## Changes
- **What**:
- New `UpcomingEventsSection.test.ts` stubs the derived `upcomingEvents`
list (`vi.mock` + `importOriginal`) and covers what the e2e can no
longer see: one row per event, localized title/blurb/location/date, and
the streamed-vs-external link branch (`/events/{id}` vs the external
href with `target=_blank` + `rel`), including the zh-CN event-page href.
- `events.spec.ts` now asserts the list container renders even when
there are no rows, so a zero-row page is still a real assertion rather
than a vacuous `toHaveCount(0)`.
- Corrected the comment on the derivation (`BUILD_NOW` → `NOW`): the
events islands re-evaluate it in the browser on hydration, so
classification is **not** fixed at build time as the old comment
claimed.
## Review Focus
**Why prod is empty is not a bug in the fetch/render logic.** The data
is not remote — it is the hard-coded array in `src/data/events.ts`. The
only dynamic input is the clock: `deriveUpcomingEvents` keeps events
whose end (start + 1h default) is still in the future. The newest
configured event, `video-model-showdown`, ended `2026-08-12T18:00Z`, and
nothing is scheduled after it, so `upcomingEvents` is `[]` and the `ul`
renders as `<!--[--><!--]-->`. A locally built `dist/events/index.html`
reproduces the reported prod markup byte-for-byte. The page needs a
content refresh, not a code fix.
**Two findings worth separate follow-ups (deliberately not changed
here):**
1. `<UpcomingEventsSection client:visible />` ships the full events
array plus `new Date()` to the client, so the upcoming/past split is
re-derived from the *visitor's* clock at hydration. Freezing the browser
clock to `2026-08-01` against the current build makes 2 rows appear
where the build rendered 0, along with a burst of Vue `Hydration
text/children mismatch` warnings — i.e. real visitors on a build older
than an event's end get a visible post-hydration content shift on
`/events`. Making it deterministic per-deploy is a behaviour change (a
finished livestream would linger as "upcoming" until the next deploy),
so it needs a product call.
2. With zero upcoming events the section still renders its heading over
an empty card (first screenshot). An empty state — hiding the section,
or a "nothing scheduled yet" line — would be an improvement, but that is
a design decision.
Follows up Comfy-Org#15150, which stopped the CI failure by guarding the one
unguarded test; this addresses the coverage hole that guard left behind.
## Screenshots
Both taken against a local production build. The first is today's real
clock (reproduces prod); the second freezes the browser clock to
`2026-08-01`, showing the render logic itself is healthy.
## Verification
- `pnpm test:unit` (website): 42 files, 399 tests passing, including the
3 new ones.
- `pnpm typecheck` (astro check): 0 errors, 0 warnings.
- oxfmt, oxlint `--type-aware`, and eslint clean on the changed files
(also via pre-commit hooks).
- `playwright test events.spec.ts --project=desktop --project=mobile`: 7
passed, 2 skipped (the two time-dependent tests, correctly skipped with
zero upcoming events).
- Mutation-checked rather than assumed: inverting the link branch fails
2 of the new tests, deleting the location text fails a third, and
replacing the `ul` with a `div` fails the new e2e assertion — which
previously passed silently.
## Screenshots


---------
Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>1 parent 1e16aa9 commit 296fc5c
3 files changed
Lines changed: 130 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
188 | 191 | | |
189 | 192 | | |
190 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
580 | | - | |
581 | | - | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
582 | 584 | | |
583 | | - | |
| 585 | + | |
584 | 586 | | |
585 | | - | |
| 587 | + | |
586 | 588 | | |
587 | | - | |
| 589 | + | |
588 | 590 | | |
589 | 591 | | |
590 | 592 | | |
| |||
Lines changed: 119 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
0 commit comments