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

test_that("async_extract_bytes: Async extract_bytes call on PDF document", {
  result <- jsonlite::fromJSON(extract_bytes(content = readBin(.resolve_fixture("pdf/fake_memo.pdf"), what = "raw", n = file.info(.resolve_fixture("pdf/fake_memo.pdf"))$size), mime_type = "application/pdf", config = ExtractionConfig$default()), simplifyVector = FALSE)
  expect_true(TRUE)
  expect_equal(trimws(result$mime_type), "application/pdf")
  expect_true(nchar(result$content) >= 50)
})

test_that("async_extract_bytes_empty_mime: extract_bytes empty MIME async", {
  expect_error(extract_bytes(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("async_extract_bytes_invalid_mime: extract_bytes unsupported MIME async", {
  expect_error(extract_bytes(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()))
})
