tests/testthat/test-warnings.R

context("Warnings")

test_that("Routing to errors and 404s works", {
  r <- pr(test_path("files/warn.R"))

  res <- plumber:::PlumberResponse$new("json")

  expect_equal(options("warn")[[1]], 0)
  expect_warning(r$route(make_req("GET", "/warning"), res), "this is a warning")
  expect_equal(res$status, 1)
  expect_equal(options("warn")[[1]], 0)
})
trestletech/plumber documentation built on March 16, 2024, 8:21 a.m.