Skip to content

Write unit tests for useWallet hook state transitions #18

Description

@Code-Paragon

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

  • Feature works as described
  • Tests are added or updated where needed
  • Documentation is updated where needed
  • Freighter API methods are successfully mocked using Jest
  • No TypeScript, lint, test, or build errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions