test: increase code coverage to 100%#14
Conversation
Add comprehensive tests covering all code paths: - All _normalize_* helper edge cases (non-dict, non-string, empty, non-existent, non-directory, non-file inputs) - _working_directory with real path (chdir/restore) - _validate_message, _validate_branch real engine calls - _validate_push, _validate_author, _validate_all internal branches - All MCP tool error paths (empty/none values) - validate_repository_state with all flag combinations - server_health, describe_validation_rules edge cases - main() entry point via patched mcp.run 65 tests total, 100% statement coverage on server.py
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
============================================
+ Coverage 66.02% 100.00% +33.97%
============================================
Files 2 2
Lines 209 209
============================================
+ Hits 138 209 +71
+ Misses 71 0 -71 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Increases test coverage from 66% to 100% by adding comprehensive tests for all code paths in
commit_check_mcp.server.Changes
New test coverage for:
_normalize_config— non-dict input raises ValueError_normalize_repo_path— non-string, empty, non-existent, file-path inputs_normalize_config_path— non-string, empty, non-existent, non-file inputs_working_directory— actual chdir/restore behavior with a real path_validate_message— real commit-check engine calls (passing and failing)_validate_branch— real engine call with branch name_validate_push— real engine enforcement ofno_force_pushrule_validate_author— all branches: both name+email, only name, only email, neither_validate_all— all combinations: message, branch, author name, author emailvalidate_repository_state— all flag combinations, overall fail statusdescribe_validation_rules— config override mergingserver_health— returns all expected keysmain()— entry point invokesmcp.run(transport="stdio")Retained existing tests
All original tests are preserved (and improved where needed), including:
_run_checksDetails
server.pyand__init__.py