// 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: pdf

use kreuzberg::render_pdf_page_to_png;

#[test]
fn test_render_pdf_page_first() {
    // render_pdf_page_to_png: first page
    let pdf_bytes = std::fs::read(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/../../test_documents/pdf/fake_memo.pdf"
    ))
    .expect("test_documents/pdf/fake_memo.pdf must exist");
    let page_index = 0;
    let result = render_pdf_page_to_png(&pdf_bytes, page_index, None, None).expect("should succeed");
    assert!(result.len() >= 100, "expected length >= 100, got {}", result.len());
}

#[test]
fn test_render_pdf_page_out_of_range() {
    // render_pdf_page_to_png: page out of range
    let pdf_bytes = std::fs::read(concat!(
        env!("CARGO_MANIFEST_DIR"),
        "/../../test_documents/pdf/fake_memo.pdf"
    ))
    .expect("test_documents/pdf/fake_memo.pdf must exist");
    let page_index = 999;
    let result = render_pdf_page_to_png(&pdf_bytes, page_index, None, None);
    assert!(result.is_err(), "expected call to fail");
}
