// 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: detection. */
class DetectionTest {

    @Test
    void testDetectMimeBytesHtml() throws Exception {
        // Detect HTML MIME from bytes
        var result = Kreuzberg.detectMimeTypeFromBytes(java.nio.file.Files.readAllBytes(java.nio.file.Path.of("html/html.html")));


    }


    @Test
    void testDetectMimeBytesPdf() throws Exception {
        // Detect PDF MIME type from bytes
        var result = Kreuzberg.detectMimeTypeFromBytes(java.nio.file.Files.readAllBytes(java.nio.file.Path.of("pdf/fake_memo.pdf")));


    }


    @Test
    void testDetectMimeBytesPng() throws Exception {
        // Detect PNG MIME type from bytes
        var result = Kreuzberg.detectMimeTypeFromBytes(java.nio.file.Files.readAllBytes(java.nio.file.Path.of("images/test_hello_world.png")));


    }


    @Test
    void testGetExtensionsUnknownMime() throws Exception {
        // get_extensions unknown MIME
        // 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.getExtensionsForMime("application/x-totally-unknown");
        });

    }

}
