#![allow(
dead_code,
unused_imports,
unused_variables,
deprecated,
clippy::all,
clippy::unwrap_used,
clippy::expect_used,
clippy::panic,
unused_mut
)]
use ggen_cli_lib::run_for_node;
#[tokio::test]
async fn test_run_for_node_version() {
let args = vec!["--version".to_string()];
let result = run_for_node(args).await;
assert!(result.is_ok(), "Version command should succeed");
let run_result = result.unwrap();
assert!(
run_result.code == 0 || run_result.code == 1,
"Exit code should be 0 or 1 for version"
);
}
#[tokio::test]
async fn test_run_for_node_help() {
let args = vec!["--help".to_string()];
let result = run_for_node(args).await;
assert!(result.is_ok(), "Help command should succeed");
let run_result = result.unwrap();
assert!(
run_result.code == 0 || run_result.code == 1,
"Exit code should be 0 or 1 for help"
);
}
#[tokio::test]
async fn test_run_for_node_invalid_command() {
let args = vec!["totally-invalid-command".to_string()];
let result = run_for_node(args).await;
assert!(
result.is_ok(),
"Should return Ok(RunResult) even for errors"
);
let run_result = result.unwrap();
assert_ne!(
run_result.code, 0,
"Exit code should be non-zero for invalid command"
);
}
#[tokio::test]
async fn test_run_for_node_list_command() {
let args = vec!["list".to_string()];
let result = run_for_node(args).await;
assert!(result.is_ok(), "List command should succeed");
let run_result = result.unwrap();
assert!(true, "Should return some exit code");
}
#[tokio::test]
async fn test_run_for_node_marketplace_help() {
let args = vec!["market".to_string(), "--help".to_string()];
let result = run_for_node(args).await;
assert!(result.is_ok(), "Market help command should succeed");
let run_result = result.unwrap();
assert!(
run_result.code == 0 || run_result.code == 1,
"Exit code should be 0 or 1 for help"
);
}
#[tokio::test]
async fn test_run_for_node_lifecycle_help() {
let args = vec!["lifecycle".to_string(), "--help".to_string()];
let result = run_for_node(args).await;
assert!(result.is_ok(), "Lifecycle help command should succeed");
let run_result = result.unwrap();
assert!(
run_result.code == 0 || run_result.code == 1,
"Exit code should be 0 or 1 for help"
);
}
#[tokio::test]
async fn test_run_for_node_captures_stdout() {
let args = vec!["--version".to_string()];
let result = run_for_node(args).await.unwrap();
assert!(
result.code == 0 || result.code == 1,
"Version command should execute"
);
}
#[tokio::test]
async fn test_run_for_node_captures_stderr_on_error() {
let args = vec!["invalid-subcommand".to_string()];
let result = run_for_node(args).await.unwrap();
assert_ne!(result.code, 0, "Should have non-zero exit code");
}
#[tokio::test]
async fn test_run_for_node_empty_args() {
let args: Vec<String> = vec![];
let result = run_for_node(args).await;
assert!(result.is_ok(), "Empty args should be handled gracefully");
let run_result = result.unwrap();
assert!(true, "Should return some exit code");
}
#[tokio::test]
async fn test_run_for_node_multiple_args() {
let args = vec![
"market".to_string(),
"search".to_string(),
"rust".to_string(),
];
let result = run_for_node(args).await;
assert!(result.is_ok(), "Multi-arg command should execute");
let run_result = result.unwrap();
assert!(true, "Should return an exit code");
}