// 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 package e2e_test import ( "os" "testing" kreuzberg "github.com/kreuzberg-dev/kreuzberg/v5" ) func Test_DetectMimeBytesHtml(t *testing.T) { // Detect HTML MIME from bytes contentBytes, contentBytesErr := os.ReadFile(`html/html.html`) if contentBytesErr != nil { t.Fatalf("read fixture html/html.html: %v", contentBytesErr) } _, err := kreuzberg.DetectMimeTypeFromBytes(contentBytes) if err != nil { t.Fatalf("call failed: %v", err) } } func Test_DetectMimeBytesPdf(t *testing.T) { // Detect PDF MIME type from bytes contentBytes, contentBytesErr := os.ReadFile(`pdf/fake_memo.pdf`) if contentBytesErr != nil { t.Fatalf("read fixture pdf/fake_memo.pdf: %v", contentBytesErr) } _, err := kreuzberg.DetectMimeTypeFromBytes(contentBytes) if err != nil { t.Fatalf("call failed: %v", err) } } func Test_DetectMimeBytesPng(t *testing.T) { // Detect PNG MIME type from bytes contentBytes, contentBytesErr := os.ReadFile(`images/test_hello_world.png`) if contentBytesErr != nil { t.Fatalf("read fixture images/test_hello_world.png: %v", contentBytesErr) } _, err := kreuzberg.DetectMimeTypeFromBytes(contentBytes) if err != nil { t.Fatalf("call failed: %v", err) } } func Test_GetExtensionsUnknownMime(t *testing.T) { // get_extensions unknown MIME _, err := kreuzberg.GetExtensionsForMime(`application/x-totally-unknown`) if err == nil { t.Errorf("expected an error, but call succeeded") } }