Skip to content

test: comprehensive tests for StellarService and PathPaymentService (Stellar RPC integration) #218

@KingFRANKHOOD

Description

@KingFRANKHOOD

Problem

StellarService and PathPaymentService call Stellar RPC but have no test coverage, risking network call failures at runtime.

Scope

Add tests for StellarService:

  • getAccountBalance(): fetches USDC balance for valid address, handles account not found (returns 0), handles network timeouts gracefully
  • Keypair validation: only valid Ed25519 keys accepted
  • Network error handling: retry logic (if implemented), fallback behavior

Add tests for PathPaymentService:

  • getPathPaymentQuote(): given source amount/asset, returns valid path payment quotes
  • Multi-hop paths: correctly identifies optimal conversion path (NGN → intermediary → USDC)
  • Error handling: no path exists (illiquid pair), network timeouts
  • Response parsing: quote amount extracted correctly

Add tests for WalletService:

  • getUsdcBalance(): delegates to StellarService, correct asset code passed

Acceptance Criteria

  • Mock Stellar SDK RpcServer for integration tests
  • Test happy path: valid address returns balance
  • Test error paths: invalid address (not found on ledger), malformed address (invalid base32)
  • Test network errors: timeout, 503 Service Unavailable, connection refused
  • Test edge cases: zero balance, extremely large balance (>1B USDC)
  • Verify RPC calls are rate-limited appropriately

Estimated Effort

Medium (2-3 half-days)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendNode.js / Express / Prisma backendenhancementNew feature or requesthighSignificant bug or missing feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions