//! Tests for templates module

use crate::init::templates::{get_all_templates, get_template_by_id, get_template_by_type};
use crate::init::types::TemplateType;

#[test]
fn test_get_all_templates() {
    let templates = get_all_templates();
    assert_eq!(templates.len(), 4);
}

#[test]
fn test_get_template_by_id() {
    let template = get_template_by_id("rover").unwrap();
    assert_eq!(template.id(), "rover");
    assert_eq!(template.name(), "Rover");
    assert!(template.default_nodes.contains(&"motor".to_string()));
}

#[test]
fn test_get_template_by_id_invalid() {
    assert!(get_template_by_id("invalid").is_none());
}

#[test]
fn test_get_template_by_type() {
    let template = get_template_by_type(TemplateType::Rover);
    assert_eq!(template.template_type, TemplateType::Rover);
}
