# 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: error

test_that("error_empty_bytes: Graceful handling of empty bytes (should not error)", {
  result <- jsonlite::fromJSON(extract_bytes_sync(content = readBin(.resolve_fixture("text/empty.txt"), what = "raw", n = file.info(.resolve_fixture("text/empty.txt"))$size), mime_type = "text/plain", config = ExtractionConfig$default()), simplifyVector = FALSE)
  expect_true(TRUE)
})

test_that("error_empty_mime: Error when extracting with empty MIME type", {
  expect_error(extract_bytes_sync(content = readBin(.resolve_fixture("text/plain.txt"), what = "raw", n = file.info(.resolve_fixture("text/plain.txt"))$size), mime_type = "", config = ExtractionConfig$default()))
})

test_that("error_extract_bytes_conflicting_ocr: extract_bytes force+disable OCR", {
  expect_error(extract_bytes_sync(content = readBin(.resolve_fixture("text/fake_text.txt"), what = "raw", n = file.info(.resolve_fixture("text/fake_text.txt"))$size), mime_type = "text/plain", config = ExtractionConfig$from_json(jsonlite::toJSON(list("disable_ocr" = TRUE, "force_ocr" = TRUE), auto_unbox = TRUE))))
})

test_that("error_invalid_mime_format: Error when extracting with invalid MIME type format", {
  expect_error(extract_bytes_sync(content = readBin(.resolve_fixture("text/plain.txt"), what = "raw", n = file.info(.resolve_fixture("text/plain.txt"))$size), mime_type = "not-a-mime", config = ExtractionConfig$default()))
})

test_that("error_unsupported_mime: Error when extracting with unsupported MIME type", {
  expect_error(extract_bytes_sync(content = readBin(.resolve_fixture("text/plain.txt"), what = "raw", n = file.info(.resolve_fixture("text/plain.txt"))$size), mime_type = "application/x-nonexistent", config = ExtractionConfig$default()))
})
