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
- 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
Description
src/lib/stellarRpcFailure.tsmaps errors into classes includingTX_RESULT_CODEandOP_RESULT_CODE, butsrc/lib/stellarRpcFailure.test.tsshould comprehensively cover Horizon result-code shapes such astx_bad_seq,tx_insufficient_fee,op_no_destination, andop_underfunded, plus theshouldRetryflags for each. Expand coverage so every branch of the classifier is exercised.Requirements and context
src/lib/stellarRpcFailure.ts,src/lib/stellarRpcFailure.test.tsSuggested execution
git checkout -b test/stellar-failure-result-codesextras.result_codespayloadsTX_RESULT_CODE/OP_RESULT_CODEandshouldRetryUNKNOWNfallback for unrecognized shapesTest and commit
npm testExample commit message
test: cover Horizon result-code classificationGuidelines