Skip to content

test: unit tests for hook handlers (GIT-57)#24

Merged
TonyCasey merged 1 commit intomainfrom
tony/git-57-unit-tests-for-hook-handlers
Feb 12, 2026
Merged

test: unit tests for hook handlers (GIT-57)#24
TonyCasey merged 1 commit intomainfrom
tony/git-57-unit-tests-for-hook-handlers

Conversation

@TonyCasey
Copy link
Copy Markdown
Owner

@TonyCasey TonyCasey commented Feb 12, 2026

Summary

  • Add non-Error throw handling tests for SessionStartHandler and PromptSubmitHandler
  • Verify formatter is not called when no memories exist (early return path)
  • SessionStopHandler already had full coverage including non-Error throws
  • All 195 unit tests pass, 0 failures

Closes GIT-57

Test plan

  • All 17 handler tests pass
  • Full unit test suite passes (195 tests)
  • Type-check and lint clean

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Enhanced test coverage for error handling in request handlers to ensure non-standard error throws are properly caught and converted to Error objects.
    • Improved test assertions to verify that formatter operations are only executed when applicable data is available.

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>
Copilot AI review requested due to automatic review settings February 12, 2026 20:11
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Test 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

Cohort / File(s) Summary
Handler Test Enhancements
tests/unit/application/handlers/PromptSubmitHandler.test.ts, tests/unit/application/handlers/SessionStartHandler.test.ts
Added test cases for non-Error throw handling and modified "no memories" tests to verify formatter is not called when memories list is empty using a formatter spy that tracks invocation state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding unit tests for hook handlers with the associated ticket reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tony/git-57-unit-tests-for-hook-handlers

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@TonyCasey TonyCasey merged commit a6179b1 into main Feb 12, 2026
9 checks passed
@TonyCasey TonyCasey deleted the tony/git-57-unit-tests-for-hook-handlers branch February 12, 2026 20:22
@TonyCasey TonyCasey restored the tony/git-57-unit-tests-for-hook-handlers branch February 14, 2026 15:10
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.

2 participants