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>
This commit is contained in:
@@ -154,7 +154,7 @@ Tests that already use good patterns:
|
||||
**Recommendation**: Mix - some can share, some need isolation
|
||||
|
||||
#### Misc Tests:
|
||||
- **compact_test.go** (10 tests)
|
||||
- ✅ **compact_test.go** (10 tests → 1 suite + 4 standalone = Phase 2 DONE)
|
||||
- **duplicates_test.go** (5 tests)
|
||||
- **epic_test.go** (3 tests)
|
||||
- **hooks_test.go** (6 tests)
|
||||
|
||||
Reference in New Issue
Block a user