Skip to content

test(wallet): assert address-copied toast in WalletScreen copy test (… - #1032

Open
extolkom wants to merge 1 commit into
Sorokit:mainfrom
extolkom:refactor/unify-toast-context-851
Open

extolkom wants to merge 1 commit into
Sorokit:mainfrom
extolkom:refactor/unify-toast-context-851

Conversation

@extolkom

Copy link
Copy Markdown
Contributor

Summary

closes #851

Adds the missing toast assertion to the copy test in WalletScreen.test.tsx. This is a test-only change, with no production code touched.

Context

The behavior #851 describes was already fixed in #829 (merge commit 5a11f40, Oct 1). On main today:

  • WalletScreen.tsx and AccountCard.tsx have no local copied state and no inline fixed-position toast markup.
  • Both call useToast() (success(...), which wraps addToast, and error(...) in AccountCard).
  • A single ToastRenderer / ToastContainer is mounted in App.tsx.

The one gap left is the issue's fourth acceptance criterion. WalletScreen.test.tsx sets up a successToast mock but the copy test never asserts it.

Changes

  • src/screens/WalletScreen.test.tsx: after triggering copy, assert successToast is called once with "Address Copied" and the message "The address has been copied to your clipboard."

No changes to WalletScreen.tsx, AccountCard.tsx or ToastContext.tsx. I deliberately did not rewrite success(...) as addToast({ type: "success", ... }), since success is a thin wrapper and the behavior is identical.

Acceptance criteria mapping

Criterion Status
Neither file manages a local copied-state toast Already met (#829)
Both call useToast() Already met (via the success/error wrappers)
Single ToastContainer handles all toasts Already met (App.tsx)
Both test files verify toast display via the context mock Completed by this PR (AccountCard.test.tsx already did)

How to verify

  1. npm test -- src/screens/WalletScreen.test.tsx
  2. To confirm the assertion is meaningful, temporarily remove the success(...) call from the onCopy handler in WalletScreen.tsx and see the test fail.

Testing

  • npm run lint
  • npm run typecheck
  • npm run build
  • npm run size
  • npm run test:exports
  • npm test

(Tick each box only after seeing the command pass.)## Summary
Refs #851

Adds the missing toast assertion to the copy test in WalletScreen.test.tsx. This is a test-only change, with no production code touched.

Context

The behavior #851 describes was already fixed in #829 (merge commit 5a11f40, Oct 1). On main today:

  • WalletScreen.tsx and AccountCard.tsx have no local copied state and no inline fixed-position toast markup.
  • Both call useToast() (success(...), which wraps addToast, and error(...) in AccountCard).
  • A single ToastRenderer / ToastContainer is mounted in App.tsx.

The one gap left is the issue's fourth acceptance criterion. WalletScreen.test.tsx sets up a successToast mock but the copy test never asserts it.

Changes

  • src/screens/WalletScreen.test.tsx: after triggering copy, assert successToast is called once with "Address Copied" and the message "The address has been copied to your clipboard."

No changes to WalletScreen.tsx, AccountCard.tsx or ToastContext.tsx. I deliberately did not rewrite success(...) as addToast({ type: "success", ... }), since success is a thin wrapper and the behavior is identical.

Acceptance criteria mapping

Criterion Status
Neither file manages a local copied-state toast Already met (#829)
Both call useToast() Already met (via the success/error wrappers)
Single ToastContainer handles all toasts Already met (App.tsx)
Both test files verify toast display via the context mock Completed by this PR (AccountCard.test.tsx already did)

How to verify

  1. npm test -- src/screens/WalletScreen.test.tsx
  2. To confirm the assertion is meaningful, temporarily remove the success(...) call from the onCopy handler in WalletScreen.tsx and see the test fail.

Testing

  • npm run lint
  • npm run typecheck
  • npm run build
  • npm run size
  • npm run test:exports
  • npm test

(Tick each box only after seeing the command pass.)

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.

Dual toast implementations — WalletScreen and AccountCard bypass ToastContext

1 participant