Skip to content

Expand stellarRpcFailure classification tests to cover Horizon tx/op result codes #349

@thlpkee20-wq

Description

@thlpkee20-wq

Description

src/lib/stellarRpcFailure.ts maps errors into classes including TX_RESULT_CODE and OP_RESULT_CODE, but src/lib/stellarRpcFailure.test.ts should comprehensively cover Horizon result-code shapes such as tx_bad_seq, tx_insufficient_fee, op_no_destination, and op_underfunded, plus the shouldRetry flags for each. Expand coverage so every branch of the classifier is exercised.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: src/lib/stellarRpcFailure.ts, src/lib/stellarRpcFailure.test.ts
  • Tests must assert raw upstream messages never leak into the classified output

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b test/stellar-failure-result-codes
  • Implement changes
    • Add fixtures for Horizon extras.result_codes payloads
    • Assert mapping to TX_RESULT_CODE/OP_RESULT_CODE and shouldRetry
    • Assert UNKNOWN fallback for unrecognized shapes
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • npm test
  • Cover edge cases
    • Nested result codes, missing extras, non-Error objects, null/undefined input
  • Include test output and notes

Example commit message

test: cover Horizon result-code classification

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions