Files
fil/e2e/r/tests/test_mime_utilities.R

22 lines
1.1 KiB
R
Raw Permalink Normal View History

2026-06-01 23:40:55 +02:00
# 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: mime_utilities
test_that("mime_detect_bytes: Detect MIME type from file bytes", {
result <- detect_mime_type_from_bytes(content = readBin(.resolve_fixture("pdf/fake_memo.pdf"), what = "raw", n = file.info(.resolve_fixture("pdf/fake_memo.pdf"))$size))
expect_true(grepl("pdf", result, fixed = TRUE))
})
test_that("mime_detect_image: Detect MIME type from PNG image bytes", {
result <- detect_mime_type_from_bytes(content = readBin(.resolve_fixture("images/test_hello_world.png"), what = "raw", n = file.info(.resolve_fixture("images/test_hello_world.png"))$size))
expect_true(grepl("png", result, fixed = TRUE))
})
test_that("mime_get_extensions: Get file extensions for a MIME type", {
result <- get_extensions_for_mime(mime_type = "application/pdf")
expect_true(grepl("pdf", result, fixed = TRUE))
})