Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions crates/hydra-codegen/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,43 @@ fn output_flags_compile_and_parse_as_boolean_presentation_options() {
assert_eq!(params, serde_json::json!({}));
}

#[test]
fn output_flags_render_declared_help_from_compiled_cli() {
let list_records_help = FixtureCli::try_parse_from(["fixture", "list-records", "--help"])
.expect_err("list-records help exits through clap");
assert_eq!(
list_records_help.kind(),
clap::error::ErrorKind::DisplayHelp,
"list-records --help must render help"
);
let list_records_help = list_records_help.render().to_string();
assert!(
list_records_help.contains("--include-cursor"),
"list-records help must expose the exact output flag: {list_records_help}"
);
assert!(
list_records_help.contains("Include the checkpoint alongside each displayed record"),
"list-records help must expose the declared output-flag description: {list_records_help}"
);

let status_help = FixtureCli::try_parse_from(["fixture", "status", "--help"])
.expect_err("status help exits through clap");
assert_eq!(
status_help.kind(),
clap::error::ErrorKind::DisplayHelp,
"status --help must render help"
);
let status_help = status_help.render().to_string();
assert!(
status_help.contains("--verbose"),
"status help must expose the exact output flag: {status_help}"
);
assert!(
status_help.contains("Include verbose status presentation details"),
"status help must expose the declared output-flag description: {status_help}"
);
}

#[test]
fn output_flags_stay_out_of_request_and_mcp_projections() {
let definition = cli_output_flags_definition();
Expand Down
Loading