镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

test(user-status): pin the clock so the deadline test passes on a month's last day - #2065

Closed
matt2e wants to merge 1 commit into
mainfrom
jitter/fix-status-editor-month-end
Closed

matt2e wants to merge 1 commit into
mainfrom
jitter/fix-status-editor-month-end

Conversation

@matt2e

@matt2e matt2e commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Problem

main fails one Vitest test in StatusEditor.test.tsx: "prefills and preserves an existing deadline, and validates a custom date before saving". The failure is Unable to find role="button" and name /^Today,/. It started on main's 00:27 UTC run on Oct 31 (job), and every PR's JavaScript shard now fails on it.

The test prefills a deadline for tomorrow, and StatusExpiration opens the calendar on that month (defaultMonth={value}). On the last day of a month, tomorrow falls in the next month, so the calendar doesn't show today and the test can't find the "Today," button. The product behaviour is fine. Only the test depends on the date.

Fix

Only this test is changed: Date is pinned to mid-month (Oct 14, 2026, at noon) using vi.useFakeTimers({ toFake: ["Date"] }), the same approach as SearchResults.test.tsx. Timers stay real, so userEvent behaves as before. afterEach now restores real timers.

Validation

  • Ran locally on Oct 31: without the change, the test fails with the same error as CI. With it, StatusEditor.test.tsx passes all 20 tests.
  • vitest run src/features/user-status: 26 tests pass. Biome is clean.

🤖 Generated with Claude Code

…th's last day

The prefilled deadline is tomorrow, and the calendar opens on that month. On the
last day of a month that is next month, so the "Today," button the test clicks
isn't shown and the test fails. Pin the date to mid-month.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-authored-by: Jitter <2b2e6415e748c35180847a37aadae06a11e30dddc76b784e7fd9354c4eb42e7a@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matt2e
matt2e requested a review from a team as a code owner October 31, 2026 00:53
@matt2e

matt2e commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Closing as a duplicate of #2064, which kalvinnchau opened a few minutes earlier with the same fix.

@matt2e matt2e closed this Oct 31, 2026
@matt2e
matt2e deleted the jitter/fix-status-editor-month-end branch October 31, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant