Skip to content

Add inspection methods to Command for testing#224

Merged
ryanoneill merged 2 commits intomainfrom
feature/command-inspection
Mar 9, 2026
Merged

Add inspection methods to Command for testing#224
ryanoneill merged 2 commits intomainfrom
feature/command-inspection

Conversation

@ryanoneill
Copy link
Owner

Summary

  • Add public inspection methods to Command<M>: is_quit(), is_message(), is_batch(), is_async(), is_overlay_push(), is_overlay_pop(), and action_count()
  • These methods allow users to test their update() functions by inspecting what kind of command was returned, without needing access to the internal CommandAction enum
  • Each method includes doc tests with realistic usage examples and comprehensive unit tests

Test plan

  • Added 7 doc tests covering all new methods
  • Added 28 unit tests covering positive cases, negative cases, and combined commands
  • All existing tests continue to pass
  • cargo clippy --all-features -- -D warnings passes with no warnings
  • Both files remain under 1000 lines (mod.rs: 799, tests.rs: 832)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.09%. Comparing base (fa6edbb) to head (5b81257).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #224   +/-   ##
=======================================
  Coverage   92.09%   92.09%           
=======================================
  Files         146      146           
  Lines       12798    12824   +26     
=======================================
+ Hits        11786    11810   +24     
- Misses       1012     1014    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryanoneill ryanoneill force-pushed the feature/command-inspection branch from c461b7c to 5b81257 Compare March 9, 2026 18:06
@ryanoneill ryanoneill merged commit f41ec33 into main Mar 9, 2026
17 checks passed
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