Files
beads/cmd/bd/compact_test.go
Steve Yegge 672377544b test: Refactor compact_test.go to use shared DB pattern (bd-1rh)
Part of Phase 2/3 test suite optimization.

BEFORE:
- 10 separate test functions
- Each creating its own database
- 6 tests with DB setup overhead
- Total: 10 test executions

AFTER:
- 1 TestCompactSuite with 6 shared-DB subtests
- 4 standalone tests (no DB needed)
- Single DB setup for suite
- Total: 5 test functions

IMPACT:
- Lines: -135 (-22.4%)
- DB setups: 6 → 1 (6x reduction)
- Tests passing: 10/10 ✓
- Runtime: ~0.33s

The suite consolidates all DB-dependent tests:
- DryRun: eligibility check on closed issue
- Stats: mix of eligible/ineligible issues
- RunCompactStats: tests both normal and JSON output
- CompactStatsJSON: JSON formatting path
- RunCompactSingleDryRun: single issue eligibility
- RunCompactAllDryRun: multiple issue eligibility

Standalone tests (no DB):
- TestCompactValidation: flag validation logic
- TestCompactProgressBar: progress bar formatting
- TestFormatUptime: uptime display formatting
- TestCompactInitCommand: command initialization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 16:13:18 -05:00

9.0 KiB