//! Tests for types module

use crate::init::types::{ProjectConfig, TemplateType};

#[test]
fn test_template_type_parsing() {
    assert_eq!(TemplateType::from_str("basic"), Some(TemplateType::Basic));
    assert_eq!(TemplateType::from_str("rover"), Some(TemplateType::Rover));
    assert_eq!(TemplateType::from_str("ROVER"), Some(TemplateType::Rover));
    assert_eq!(TemplateType::from_str("invalid"), None);
}

#[test]
fn test_template_type_as_str() {
    assert_eq!(TemplateType::Basic.as_str(), "basic");
    assert_eq!(TemplateType::Rover.as_str(), "rover");
}

#[test]
fn test_project_config_builder() {
    let config = ProjectConfig::new("test-robot", TemplateType::Rover)
        .with_node("speaker")
        .with_node("listener")
        .with_dev_mode(true);

    assert_eq!(config.name, "test-robot");
    assert_eq!(config.template, TemplateType::Rover);
    assert_eq!(config.nodes, vec!["speaker", "listener"]);
    assert!(config.dev_mode);
}
