📋 Description
lib/client/useSessionExpiry.ts drives the session-expiry warning rendered by components/SessionExpiryNotification.tsx and wired through components/SessionExpiryProvider.tsx. There are session tests under tests/session, but the client hook's timer/countdown logic and re-authentication trigger are not directly covered.
Why this matters: a wallet-authenticated session that expires mid-flow without a clear warning can drop a user in the middle of a send. The countdown and re-auth prompt are trust-critical.
🎯 Requirements & Context
Functional requirements
Context & constraints
- Vitest
environment: node; mock timers with vi.useFakeTimers().
- If the hook reads wall-clock directly, accept an injectable clock for testability (minimal change).
🛠️ Suggested Execution
git checkout -b test/use-session-expiry
- Write the suite, add injectable clock if needed.
npm run lint
npm run test:coverage
- Edge cases: session already expired on mount, extend before expiry, rapid mount/unmount, threshold boundary tick.
Example commit message
test(session): cover useSessionExpiry countdown + cleanup
Adds Vitest fake-timer suite for warning threshold, countdown, expiry
action, re-auth reset, and unmount cleanup.
✅ Acceptance Criteria & Guidelines
| Requirement |
Target |
| Warning/countdown/expiry covered |
Required |
| Timer cleanup asserted |
Required |
| Hook coverage |
≥ 90% |
| Deterministic (fake timers) |
Required |
| Lint clean |
Required |
| Timeframe |
96 hours from assignment |
💬 Community & Support
Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA
Comment to claim before starting. 🚀
📋 Description
lib/client/useSessionExpiry.tsdrives the session-expiry warning rendered bycomponents/SessionExpiryNotification.tsxand wired throughcomponents/SessionExpiryProvider.tsx. There are session tests undertests/session, but the client hook's timer/countdown logic and re-authentication trigger are not directly covered.🎯 Requirements & Context
Functional requirements
tests/session/use-session-expiry.test.ts(matched by the existingtests/session/**Vitest include).Context & constraints
environment: node; mock timers withvi.useFakeTimers().🛠️ Suggested Execution
Example commit message
✅ Acceptance Criteria & Guidelines
💬 Community & Support
Join the RemitWise contributor community on Discord: https://discord.gg/CtQuPZFMA
Comment to claim before starting. 🚀