// Tests for mecha10_cli::infrastructure

use mecha10_cli::infrastructure::*;

#[test]
fn test_infrastructure_args() {
    let args = InfrastructureArgs {
        action: InfrastructureAction::Start,
        services: vec!["redis".to_string(), "postgres".to_string()],
    };

    assert_eq!(args.action, InfrastructureAction::Start);
    assert_eq!(args.services.len(), 2);
}

#[test]
fn test_infrastructure_action_from_str() {
    assert_eq!(InfrastructureAction::from_str("start"), Some(InfrastructureAction::Start));
    assert_eq!(InfrastructureAction::from_str("stop"), Some(InfrastructureAction::Stop));
    assert_eq!(InfrastructureAction::from_str("restart"), Some(InfrastructureAction::Restart));
    assert_eq!(InfrastructureAction::from_str("status"), Some(InfrastructureAction::Status));
    assert_eq!(InfrastructureAction::from_str("logs"), Some(InfrastructureAction::Logs));
    assert_eq!(InfrastructureAction::from_str("invalid"), None);
}

#[test]
fn test_infrastructure_action_as_str() {
    assert_eq!(InfrastructureAction::Start.as_str(), "start");
    assert_eq!(InfrastructureAction::Stop.as_str(), "stop");
    assert_eq!(InfrastructureAction::Restart.as_str(), "restart");
    assert_eq!(InfrastructureAction::Status.as_str(), "status");
    assert_eq!(InfrastructureAction::Logs.as_str(), "logs");
}
