tests/testthat/test-buildServiceRequest.R

test_that("The URL must be a string", {
  expect_error(
    .buildServiceRequest(
      serviceUrl = 123,
      distillerToken = "DISTILLER_TOKEN"))
})

test_that("The token must be a string", {
  expect_error(
    .buildServiceRequest(
      serviceUrl = "https://example.org/service",
      distillerToken = 123))
})

test_that("The body must be a list", {
  expect_error(
    .buildServiceRequest(
      serviceUrl = "https://example.org/service",
      distillerToken = "DISTILLER_TOKEN",
      body = 123))
})

test_that("The timeout must be an integer", {
  expect_error(
    .buildServiceRequest(
      serviceUrl = "https://example.org/service",
      distillerToken = "DISTILLER_TOKEN",
      timeout = ""))
})

test_that("The result must be a httr2_request", {
  expect_s3_class(
    .buildServiceRequest(
      serviceUrl = "https://example.org/service",
      distillerToken = "DISTILLER_TOKEN",
      body = list("a" = 1)),
    "httr2_request")
})

Try the distilleR package in your browser

Any scripts or data that you put into this service are public.

distilleR documentation built on April 24, 2026, 1:07 a.m.