Skip to content

web: add deterministic Drand countdown boundary tests #174

Description

@karagozemin

Summary

Add deterministic boundary tests for the Drand countdown used by the web dashboard.

Why this matters

The countdown is central to the reveal UX, but its time calculation currently lives inside a React hook and depends directly on Date.now(). Existing component tests cover rendered copy, not the exact before-R / at-R / past-R math or offline fallback behavior.

Scope

  • Extract the countdown calculation into a small pure helper that accepts target round, current time, genesis, and period.
  • Reuse the helper for both live chain info and the offline quicknet fallback in useDrandCountdown.
  • Add Node-based unit tests with fixed timestamps; no browser, live Drand call, or real timers.
  • Keep the existing UI and polling cadence unchanged.

Acceptance criteria

  • Tests cover one second before R, exactly at R, and after R.
  • Published rounds report secondsRemaining: 0.
  • Future rounds report the correct target time and remaining seconds.
  • formatCountdown has boundary cases for seconds, minutes, and hours.
  • The new test is included in pnpm web:test; web typecheck passes.

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Stellar WaveIssue proposed for the Drips Stellar Wave programarea: webWeb application and React integrationenhancementNew feature or requestgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions