Skip to content

Add CLI integration tests using a mock stellar binary to test argument parsing, error handling, and output formatting #152

Description

@ALLEN-AYODEJI

Description

The CLI has zero automated tests. Every command shells out to the stellar binary, making tests dependent on external infrastructure. A mock stellar binary that returns controlled responses would enable comprehensive CLI testing: argument parsing, error handling, output formatting, and JSON serialization.

Requirements and context

  • Security: Standard security review required for state-mutating changes
  • Testing: Full test suite must pass; new tests for changed behavior
  • Documentation: Update doc comments and README if user-facing

Suggested execution

Branch: fix/feat/test-cli-mock

Implement changes

  • Create a test_stellar.sh/bat script that simulates stellar CLI responses based on arguments
  • Add a test environment variable (TRELLIS_TEST_MODE=true) that points to the mock binary
  • Write tests for each CLI command: verify correct stellar invocation, verify output parsing
  • Add error-path tests: stellar returns error, stellar not found, stellar returns invalid JSON

Test and commit

Run CLI tests with mock binary. Verify all 8 commands are tested for success and error paths. Run cargo test.

Example commit message

feat(test): add CLI unit tests with mock stellar binary for comprehensive argument and error path testing

Guidelines

  • Open a PR against master
  • Keep PR focused on this single concern
  • Run cargo test or npm test before review
  • Ensure no lint or typecheck warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions