Skip to content

test(address-display): deterministic copied-state reset coverage (Closes #556) - #632

Open
BernardOnuh wants to merge 1 commit into
Sorokit:mainfrom
BernardOnuh:issue#556
Open

test(address-display): deterministic copied-state reset coverage (Closes #556)#632
BernardOnuh wants to merge 1 commit into
Sorokit:mainfrom
BernardOnuh:issue#556

Conversation

@BernardOnuh

Copy link
Copy Markdown
Contributor

Closes #556.

What

AddressDisplay.test.tsx already covered the bulk of this issue's acceptance criteria — default truncation via truncateAddress, showFull, clipboard invocation with the full address, the immediate "Address copied" label, the #534 non-secure-context fallbacks (navigator.clipboard undefined / rejecting / both methods failing). The one criterion not pinned down deterministically was the 2-second reset: only an implicit ~2.5s real-time waitFor in the first test exercised it.

This PR adds a copied state reset (#556) describe with two fake-timer tests:

  • keeps 'Address copied' until the 2s timeout, then resets — asserts the label flips immediately on copy, is still "Address copied" one millisecond before the 2s window elapses, and returns to "Copy address to clipboard" the instant it elapses (exact boundary, no wall-clock waiting).
  • resets the 2s window when copy is triggered again mid-window — re-copying while already in the copied state clears the pending COPIED_RESET_MS timer (clearResetTimer) and starts a fresh full 2s window; verifies the label survives a second near-full window and resets only after the renewed deadline.

Verification

  • npx vitest run src/components/AddressDisplay.test.tsx27 passed (25 existing + 2 new).
  • npx eslint src/components/AddressDisplay.test.tsx → clean.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@BernardOnuh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Write tests for AddressDisplay: truncation, copy-to-clipboard, and fallback behavior

2 participants