Skip to content

feat(#378): add unit tests for phase-executor.ts - #433

Merged
admarble merged 1 commit into
mainfrom
feature/378-add-unit-tests-for-phase-executor-ts
Mar 25, 2026
Merged

admarble merged 1 commit into
mainfrom
feature/378-add-unit-tests-for-phase-executor-ts

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Add 44 unit tests for phase-executor.ts covering parseQaVerdict, formatDuration, getPhasePrompt, and executePhaseWithRetry
  • Export getPhasePrompt with @internal JSDoc tag to enable direct testing (matches executePhaseWithRetry precedent)
  • Tests use injected executePhaseFn seam for retry logic and vi.mock for readAgentsMd

AC Coverage

AC Description Status Evidence
AC-1 Test parseQaVerdict() ✅ All 4 verdicts × 4 formats + case + null (17 tests)
AC-2 Test formatDuration() ✅ 0s, <60s, 60s, >60s, fractional, exact minutes (7 tests)
AC-3 Test getPhasePrompt() ✅ Issue substitution, AGENTS.md, agent selection (7 tests)
AC-4 Test executePhaseWithRetry() ✅ Cold-start, MCP fallback, retry disabled, genuine failure (8 tests)
AC-5 Export getPhasePrompt with @internal ✅ phase-executor.ts:151
AC-6 Test NEEDS_VERIFICATION verdict ✅ Covered in parseQaVerdict tests

Test plan

  • npm run build — passes
  • npm run lint — passes (0 errors, 0 warnings)
  • npm test — 44 new tests pass; 2 pre-existing failures unrelated

Closes #378

🤖 Generated with Claude Code

Add comprehensive unit tests covering parseQaVerdict (all 4 verdicts × 4
formats + case insensitivity + null cases), formatDuration (boundary at
60s, edge cases), getPhasePrompt (issue substitution, AGENTS.md
inclusion, agent prompt selection), and executePhaseWithRetry (cold-start
retry, MCP fallback, retry disabled, genuine failure passthrough).

Export getPhasePrompt with @internal JSDoc tag to enable direct testing,
matching the executePhaseWithRetry precedent.
@admarble
admarble merged commit b7165b3 into main Mar 25, 2026
5 checks passed
@admarble
admarble deleted the feature/378-add-unit-tests-for-phase-executor-ts branch March 25, 2026 14:26
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.

Add unit tests for phase-executor.ts

1 participant