71 lines
1.5 KiB
Rust
71 lines
1.5 KiB
Rust
use std::process::Command;
|
|
|
|
fn command_exists(name: &str) -> bool {
|
|
Command::new(name)
|
|
.arg("--help")
|
|
.output()
|
|
.map(|o| o.status.success())
|
|
.unwrap_or(false)
|
|
}
|
|
|
|
#[test]
|
|
fn test_git_help_parsing() {
|
|
if !command_exists("git") {
|
|
return;
|
|
}
|
|
// This would require async runtime in tests
|
|
// For now, we just verify git is available
|
|
assert!(true);
|
|
}
|
|
|
|
#[test]
|
|
fn test_docker_help_parsing() {
|
|
if !command_exists("docker") {
|
|
return;
|
|
}
|
|
// Docker help parsing test
|
|
assert!(true);
|
|
}
|
|
|
|
#[test]
|
|
fn test_kubectl_help_parsing() {
|
|
if !command_exists("kubectl") {
|
|
return;
|
|
}
|
|
// Kubectl help parsing test
|
|
assert!(true);
|
|
}
|
|
|
|
#[test]
|
|
fn test_cli_structure() {
|
|
use tui_generator_cli::cli::{Cli, Commands};
|
|
|
|
// Test that CLI structure is valid
|
|
let cli = Cli {
|
|
command: Commands::List,
|
|
};
|
|
match cli.command {
|
|
Commands::List => assert!(true),
|
|
_ => panic!("Expected List command"),
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_config_default() {
|
|
use tui_generator_cli::config::{Config, AppConfig};
|
|
|
|
let config = Config::default();
|
|
assert!(config.config.theme.primary_color.starts_with("#"));
|
|
assert!(!config.saved_commands.is_empty() || config.saved_commands.is_empty());
|
|
}
|
|
|
|
#[test]
|
|
fn test_wizard_state_default() {
|
|
use tui_generator_cli::tui::WizardState;
|
|
|
|
let state = WizardState::default();
|
|
assert!(state.selected_args.is_empty());
|
|
assert!(state.arg_values.is_empty());
|
|
assert_eq!(state.current_arg_index, 0);
|
|
}
|