Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<!-- snippet:syntax-only -->
```r title="R"
library(kreuzberg)
library(testthat)
uppercase_processor <- function(result) {
result$content <- toupper(result$content)
return(result)
}
test_that("uppercase processor uppercases content", {
fake_result <- list(
content = "hello world",
mime_type = "text/plain",
metadata = list()
)
processed <- uppercase_processor(fake_result)
expect_equal(processed$content, "HELLO WORLD")
})
test_that("post processor registers and runs", {
register_post_processor("uppercase", uppercase_processor)
on.exit(unregister_post_processor("uppercase"), add = TRUE)
config <- list(postprocessor = list(enabled = TRUE))
json <- extract_bytes_sync(
charToRaw("hello world"), "text/plain", config
)
result <- jsonlite::fromJSON(json, simplifyVector = FALSE)
expect_match(result$content, "HELLO WORLD", fixed = TRUE)
})
```