Skip to content

[Testing] Zero test coverage for SendTokensScreen — payment signing and Lobstr delegation #82

Description

@cybermax4200

Why this matters now: SendTokensScreen.tsx handles the entire payment flow: input validation, destination address validation, amount validation, asset selection (XLM/ECO), Lobstr delegation vs in-app signing, and transaction submission. A bug here could send tokens to wrong addresses, submit invalid transactions, or silently fail.

Problem / What: src/screens/SendTokensScreen.tsx (291 lines) — no test file. The screen has complex branching: Lobstr wallet (line 65-85) vs in-app wallet (line 87-101), with different code paths for each.

Key Challenges:

  • Mock useWalletStore, useStellarWallet, getInAppSecret.
  • Mock signAndSubmitPayment, isValidAmount, isValidPublicKey.
  • Mock openLobstrForPayment, LobstrNotInstalledError.
  • Mock Alert.alert.
  • Test: invalid destination address → error displayed.
  • Test: invalid amount → error displayed.
  • Test: Lobstr wallet → opens Lobstr, shows confirmation alert.
  • Test: in-app wallet → signs and submits, shows success alert.
  • Test: Lobstr not installed → error displayed.
  • Test: network failure → error displayed.
  • Test: input validation for destination and amount.

Acceptance Criteria:

  • Test file src/__tests__/SendTokensScreen.test.tsx with 10+ test cases.
  • Input validation for destination and amount.
  • Lobstr vs in-app signing paths.
  • Error handling for network failures and missing keys.
  • Success confirmation display.
  • All tests pass with npm test.

Relevant files/functions:

  • src/screens/SendTokensScreen.tsx (entire file)
  • src/__tests__/SendTokensScreen.test.tsx (new)

Out of scope: Real Stellar transaction submission.

Labels: testing, advanced, wallet, screens

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions