Skip to content

Test the timestamp leeway boundary with mocked timers#38

Merged
jstayton merged 1 commit into
developmentfrom
test/timestamp-boundary
May 7, 2026
Merged

Test the timestamp leeway boundary with mocked timers#38
jstayton merged 1 commit into
developmentfrom
test/timestamp-boundary

Conversation

@jstayton
Copy link
Copy Markdown
Collaborator

@jstayton jstayton commented May 7, 2026

Summary

The happy path was previously bypassing the timestamp check with leewayMinutes: 999999999, and the lone "not within allowed window" test relied on the fixture being years in the past — which only kept working while real time marched forward. Replace with explicit boundary cases pinned to a fixed clock via t.mock.timers:

  • Happy path now uses the function's default leewayMinutes with the clock pinned to the moment the request was sent.
  • Four new cases cover exactly-at-boundary (passes) and one ms past the boundary (throws), in both the future and past directions.

Test plan

  • npm test — 19/19 pass.
  • npm run lint — clean.

🤖 Generated with Claude Code

The happy path was previously bypassing the timestamp check with
`leewayMinutes: 999999999` and the lone "not within allowed window"
test relied on the fixture being years in the past, which only
worked while real time kept marching forward. Replace with explicit
boundary cases pinned to a fixed clock via `t.mock.timers`:

- Happy path now uses the function's default leeway with the clock
  pinned to the moment the request was sent.
- Four new cases cover exactly-at-boundary (passes) and one ms past
  the boundary (throws), in both the future and past directions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jstayton jstayton merged commit a8c8560 into development May 7, 2026
4 checks passed
@jstayton jstayton deleted the test/timestamp-boundary branch May 7, 2026 18:44
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