Skip to content

Write tests for BalanceList loading skeleton empty state and balance row rendering #601

Description

@k-deejah

Problem

src/components/BalanceList.tsx renders three states: a loading skeleton (3 SkeletonRow placeholders), an empty message when no balances exist, and the list of AssetRow components. None of these states have automated tests.

The duplicate key bug (key={b.asset} — tracked separately) also has no regression test, meaning it could silently re-appear after any fix. Two more specific untested behaviors: (1) the skeleton renders exactly 3 placeholder rows — not 2, not 4; (2) each AssetRow displays the correct assetCode and formatted balance string from the mock data.

Solution

Write React Testing Library tests for BalanceList using a mock SorokitProvider. Test:

  • Disconnected state: connect prompt is rendered, no balance rows visible
  • Loading state: exactly 3 skeleton rows render while isLoadingAccount is true
  • Empty state: empty-balances message renders when balances is an empty array
  • Loaded state: an AssetRow renders for each balance with the correct asset code and amount
  • No React duplicate-key warnings appear in the console during any test

Acceptance Criteria

  • Disconnected state shows connect prompt
  • Loading state renders exactly 3 skeleton placeholder rows
  • Empty state renders the empty message
  • Loaded state renders one row per balance with correct data
  • No duplicate-key React warnings during test run
  • All tests pass with npm test

Note for Contributors: If you're assigned to this issue, write a clear and detailed description for your pull request. Explain what was changed, why it was needed, how it was implemented, and include any relevant testing or screenshots where applicable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programtestsTest coverage, test setup, or test infrastructure

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions