Skip to content

Conversation

@Alex-Alaniz
Copy link

Summary

Adds the first test suite for Ralph using bats-core, the Bash Automated Testing System.

Why This Matters

Zero tests existed before this PR. Having tests:

  • Gives confidence when reviewing PRs
  • Documents expected behavior
  • Catches regressions before they ship

Test Coverage

Category Tests
Argument Parsing --tool amp, --tool claude, --tool= syntax, numeric iterations
Tool Validation Invalid tool rejection
PRD JSON Branch name extraction, story structure, required fields
Archive Logic Branch change detection, last-branch tracking
Progress File Header format
Completion Detection <promise>COMPLETE</promise> signal

Running Tests Locally

# Install bats (macOS)
brew install bats-core

# Run tests
bats tests/ralph.bats

Test plan

  • Tests pass locally with bats tests/ralph.bats
  • Tests are isolated (each test gets fresh temp directory)
  • Tests clean up after themselves

Follow-up

CI workflow will be added in a separate PR to automate test runs on push/PR.

Add comprehensive tests covering:
- Argument parsing (--tool amp/claude, max iterations)
- Tool validation (reject invalid tools)
- PRD JSON structure validation
- Archive logic when branch changes
- Progress file initialization
- Completion signal detection

Run tests locally with: bats tests/ralph.bats

Note: CI workflow will be added in a follow-up PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant