59 lines
3.5 KiB
R
59 lines
3.5 KiB
R
|
|
# 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: batch
|
||
|
|
|
||
|
|
test_that("batch_bytes_invalid_mime: batch_extract_bytes_sync invalid MIME", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_bytes_sync(items = "[{\"content\":[72,101,108,108,111],\"mime_type\":\"application/x-nonexistent\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_extract_bytes_happy: batch_extract_bytes: happy path with mixed inputs", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_bytes(items = "[{\"content\":[72,101,108,108,111,44,32,119,111,114,108,100,33],\"mime_type\":\"text/plain\"},{\"content\":[60,104,116,109,108,62,60,98,111,100,121,62,84,101,115,116,60,47,98,111,100,121,62,60,47,104,116,109,108,62],\"mime_type\":\"text/html\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
expect_true(length(result) >= 1)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_extract_bytes_mixed_format: batch_extract_bytes: handles unsupported MIME gracefully", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_bytes(items = "[{\"content\":[80,68,70,32,112,108,97,99,101,104,111,108,100,101,114],\"mime_type\":\"application/x-unknown\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_extract_bytes_sync_empty_list: batch_extract_bytes_sync: empty batch", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_bytes_sync(items = "[]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
expect_equal(length(result), 0)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_extract_bytes_sync_invalid_mime: batch_extract_bytes_sync: unsupported MIME", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_bytes_sync(items = "[{\"content\":[100,97,116,97],\"mime_type\":\"application/x-unknown\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_file_async_basic: Extract text from multiple files asynchronously", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_files(items = "[{\"path\":\"pdf/fake_memo.pdf\"},{\"path\":\"text/fake_text.txt\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_file_async_not_found: batch_extract_file async nonexistent", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_files(items = "[{\"path\":\"/nonexistent/a.pdf\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_file_not_found: batch_extract_file_sync nonexistent", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_files_sync(items = "[{\"path\":\"/nonexistent/a.pdf\"},{\"path\":\"/nonexistent/b.txt\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_file_partial: batch_extract_file_sync mixed", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_files_sync(items = "[{\"path\":\"text/plain.txt\"},{\"path\":\"/nonexistent/missing.pdf\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|
||
|
|
|
||
|
|
test_that("batch_file_sync_basic: Extract text from multiple files synchronously", {
|
||
|
|
result <- jsonlite::fromJSON(batch_extract_files_sync(items = "[{\"path\":\"pdf/fake_memo.pdf\"},{\"path\":\"text/fake_text.txt\"}]", config = ExtractionConfig$default()), simplifyVector = FALSE)
|
||
|
|
expect_true(TRUE)
|
||
|
|
})
|