test: consolidate 4 duplicate top-level-help tests into one stronger check#1538
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
…check The four `*_is_in_top_level_help` tests spread across list, disable, remove, and status integration test files were structurally identical: each spawned `ado-aw --help` separately and checked for a single word via `stdout.contains()` over the entire output. Problems: - Common words like "list" and "status" could match description prose, producing false-passes if the subcommand were hidden or removed. - Four independent process spawns for the same binary invocation. - The weaker assertion style contrasts with `configure_is_hidden_in_` `top_level_help` in secrets_integration.rs, which correctly scopes its check to the Commands section. Replace all four with a single `test_lifecycle_subcommands_appear_in_` `top_level_help_commands_section` test in cli_tests.rs that: - Spawns the binary exactly once. - Parses the Commands section (between "Commands:" and "Options:"). - Asserts each subcommand appears as an indented command entry (`" <cmd>"`), preventing prose false-positives. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Suite Reduction: top-level help integration tests
What was wrong
Four structurally identical
*_is_in_top_level_helptests were spread acrosslist_integration.rs,disable_integration.rs,remove_integration.rs, andstatus_integration.rs. Each one:ado-aw --helpas a separate processstdout.contains("<word>")over the entire help outputThe
configure_is_hidden_in_top_level_helptest insecrets_integration.rsalready shows the correct approach: parse the Commands section and scope the assertion there.Changes
tests/list_integration.rslist_is_in_top_level_helpstdout.contains("list")is too broad ("list" is a common word)tests/disable_integration.rsdisable_is_listed_in_top_level_helptests/remove_integration.rsremove_is_listed_in_top_level_helptests/status_integration.rsstatus_is_in_top_level_helptests/cli_tests.rstest_lifecycle_subcommands_appear_in_top_level_help_commands_section" <cmd>"(two leading spaces matching clap's indentation) to prevent prose false-positivesVerification
cargo check: ✅cargo test --test cli_tests --test list_integration --test disable_integration --test remove_integration --test status_integration: all tests pass ✅