Skip to content

test(wallet): add component-level disconnect and session cleanup tests - #348

Open
BigManly4 wants to merge 1 commit into
SwiftChainn:mainfrom
BigManly4:test/wallet-disconnect-cleanup
Open

test(wallet): add component-level disconnect and session cleanup tests#348
BigManly4 wants to merge 1 commit into
SwiftChainn:mainfrom
BigManly4:test/wallet-disconnect-cleanup

Conversation

@BigManly4

Copy link
Copy Markdown

Closes #330

Summary

Adds tests/components/wallet/Disconnect.test.tsx, a component-level
test suite for DisconnectButton that verifies session cleanup on
disconnect.

The existing hook-level tests in hooks/tests/useWallet.test.ts
already covered the disconnect flow at the useWallet level. This PR
adds coverage at the component boundary specified in the issue
(tests/components/wallet/Disconnect.test.tsx), rendering the real
DisconnectButton -> useWallet -> sessionService chain and mocking only
the network boundary (walletService) and next/navigation's router, per
the Component -> Hook -> Service architecture and the no-inline-mock
requirement (mock data reused from hooks/tests/fixtures/walletApiResponses.ts).

What's covered

  • Renders the connected wallet address with an enabled disconnect control
  • Clicking disconnect removes the wallet key from localStorage
  • Clicking disconnect redirects to /login
  • Cleanup and redirect still happen if the backend disconnect call rejects
  • The disabled/no-wallet-connected state performs no cleanup on click

Test plan

  • npx jest tests/components/wallet/Disconnect.test.tsx -- 5/5 passing

Add component-level tests for DisconnectButton covering the full
Component -> Hook -> Service path: clicking disconnect clears the
wallet key from localStorage, redirects to /login, and still performs
cleanup when the backend disconnect call fails. Only the network
boundary (walletService) and router are mocked; useWallet and
sessionService run unmocked so the test exercises real cleanup logic.
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@BigManly4 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.

Test: Wallet Disconnect & Session Cleanup Suite

1 participant