test: unit tests for hook handlers (GIT-57)#24
Conversation
Cover non-Error throw handling and verify formatter is skipped when no memories exist in SessionStartHandler and PromptSubmitHandler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughTest coverage expanded for PromptSubmitHandler and SessionStartHandler to verify non-Error throws are wrapped into Error objects and formatters are not invoked when memories are empty. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive unit test coverage for SessionStartHandler and PromptSubmitHandler, bringing them to parity with SessionStopHandler which already had full coverage. The tests focus on two key edge cases: handling non-Error throws and verifying the formatter is not called when no memories exist.
Changes:
- Added non-Error throw handling tests to verify error normalization logic in SessionStartHandler and PromptSubmitHandler
- Added tests verifying formatter is not called when the early return path is taken (no memories exist)
- Tests follow the same pattern as existing SessionStopHandler tests for consistency
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/unit/application/handlers/SessionStartHandler.test.ts | Added test for non-Error throw handling and formatter not called assertion for no-memories path |
| tests/unit/application/handlers/PromptSubmitHandler.test.ts | Added test for non-Error throw handling and formatter not called assertion for no-memories path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Closes GIT-57
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit