// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
// To regenerate: alef generate
// To verify freshness: alef verify --exit-code
// Issues & docs: https://github.com/kreuzberg-dev/alef
//! E2e tests for category: detection

use kreuzberg::{detect_mime_type_from_bytes, get_extensions_for_mime};

#[test]
fn test_detect_mime_bytes_html() {
    // Detect HTML MIME from bytes
    let content = std::fs::read(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/../../test_documents/html/html.html"
    ))
    .expect("test_documents/html/html.html must exist");
    let _ = detect_mime_type_from_bytes(&content).expect("should succeed");
}

#[test]
fn test_detect_mime_bytes_pdf() {
    // Detect PDF MIME type from bytes
    let content = std::fs::read(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/../../test_documents/pdf/fake_memo.pdf"
    ))
    .expect("test_documents/pdf/fake_memo.pdf must exist");
    let _ = detect_mime_type_from_bytes(&content).expect("should succeed");
}

#[test]
fn test_detect_mime_bytes_png() {
    // Detect PNG MIME type from bytes
    let content = std::fs::read(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/../../test_documents/images/test_hello_world.png"
    ))
    .expect("test_documents/images/test_hello_world.png must exist");
    let _ = detect_mime_type_from_bytes(&content).expect("should succeed");
}

#[test]
fn test_get_extensions_unknown_mime() {
    // get_extensions unknown MIME
    let mime_type = r#"application/x-totally-unknown"#;
    let result = get_extensions_for_mime(mime_type);
    assert!(result.is_err(), "expected call to fail");
}
