//! Tests for ModelService

use mecha10_cli::services::ModelService;

#[test]
fn test_load_catalog() {
    let service = ModelService::new().unwrap();
    let catalog = service.list_catalog().unwrap();

    assert!(!catalog.is_empty(), "Catalog should not be empty");

    // Check that catalog has multiple models
    assert!(catalog.len() >= 2, "Should have at least 2 models in catalog");

    // Check yolov8n-face exists
    let yolov8n = catalog.iter().find(|m| m.name == "yolov8n-face");
    assert!(yolov8n.is_some(), "yolov8n-face should be in catalog");
    assert_eq!(yolov8n.unwrap().task, "object-detection");
}

#[test]
fn test_get_catalog_entry() {
    let service = ModelService::new().unwrap();

    let entry = service.get_catalog_entry("yolov8n-face");
    assert!(entry.is_some());
    assert_eq!(entry.unwrap().name, "yolov8n-face");

    let missing = service.get_catalog_entry("nonexistent");
    assert!(missing.is_none());
}
