use crate::test_helpers::output_includes;
use crate::test_helpers::{run_fails, run_succeeds};
use std::error::Error;
#[test]
fn show_help_with_no_arguments() -> Result<(), Box<dyn Error>> {
let args: [&str; 0] = [];
run_fails(args).stderr(output_includes(
"requires a subcommand but one was not provided",
));
Ok(())
}
#[test]
fn show_subcommands_with_no_arguments() -> Result<(), Box<dyn Error>> {
let args: [&str; 0] = [];
run_fails(args).stderr(output_includes("subcommands:"));
Ok(())
}
#[test]
fn show_subcommands_with_category_name_and_help() -> Result<(), Box<dyn Error>> {
let args = ["declare", "--help"];
run_succeeds(args).stdout(output_includes("Commands:"));
Ok(())
}
#[test]
fn shows_subcommand_specific_info_with_help() -> Result<(), Box<dyn Error>> {
let args = ["declare", "queue", "--help"];
run_succeeds(args).stdout(output_includes("Usage:"));
Ok(())
}
#[test]
fn test_invalid_base_uri_fails_gracefully() {
run_fails(["--base-uri", "not-a-valid-uri", "show", "overview"])
.stderr(output_includes("Invalid base URI"));
}