Problem
The useWallet.ts Zustand store handles the crucial Freighter API connection state, but there is no testing to ensure it handles connection failures or disconnect requests gracefully.
Expected behavior
A test file verifies the default state of the hook, mocks the Freighter isConnected and requestAccess APIs, and validates that address and isConnecting mutate properly upon successful or failed connections.
Files to update
src/hooks/useWallet.test.ts (create)
Project relevance
Ensures that the core onboarding flow for users—connecting their Web3 wallet—remains bulletproof and predictable as contributors alter the codebase.
Acceptance criteria
Problem
The
useWallet.tsZustand store handles the crucial Freighter API connection state, but there is no testing to ensure it handles connection failures or disconnect requests gracefully.Expected behavior
A test file verifies the default state of the hook, mocks the Freighter
isConnectedandrequestAccessAPIs, and validates thataddressandisConnectingmutate properly upon successful or failed connections.Files to update
src/hooks/useWallet.test.ts(create)Project relevance
Ensures that the core onboarding flow for users—connecting their Web3 wallet—remains bulletproof and predictable as contributors alter the codebase.
Acceptance criteria