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

package dev.kreuzberg.e2e;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import dev.kreuzberg.Kreuzberg;
import dev.kreuzberg.ExtractionConfig;
import java.util.Optional;
import dev.kreuzberg.JsonUtil;

/** E2e tests for category: pdf. */
class PdfTest {

    @Test
    void testRenderPdfPageFirst() throws Exception {
        // render_pdf_page_to_png: first page
        var result = Kreuzberg.renderPdfPageToPng(java.nio.file.Files.readAllBytes(java.nio.file.Path.of("pdf/fake_memo.pdf")), 0, null, null);
        assertNotNull(result, "expected non-null byte[] response");
        // skipped: assertion type 'min_length' not supported on byte[] result


    }


    @Test
    void testRenderPdfPageOutOfRange() throws Exception {
        // render_pdf_page_to_png: page out of range
        // Wrap setup_lines + call_expr inside the lambda so error fixtures
        // catch failures at *any* step — including `<Type>.fromJson(...)`
        // calls that throw on malformed JSON (e.g. error fixtures with an
        // invalid enum value like `"purpose":"invalid-purpose"`). Mirrors
        // the C# `Assert.ThrowsAnyAsync(() => client.X(Type.FromJson(...)))`
        // pattern.
        assertThrows(Exception.class, () -> {
            Kreuzberg.renderPdfPageToPng(java.nio.file.Files.readAllBytes(java.nio.file.Path.of("pdf/fake_memo.pdf")), 999, null, null);
        });

    }

}
