tests/testthat/test-shiny.R

test_that("launch_rfair is exported and the bundled app parses", {
  expect_true(is.function(launch_rfair))
  app <- system.file("shiny-apps", "rfair", "app.R", package = "rfair")
  skip_if(!nzchar(app), "bundled app not found in this install")
  expect_silent(parse(app))
})

test_that("launch_rfair errors clearly without its UI dependencies", {
  # smoke: the function exists and is callable; it will stop() if shiny/bslib/DT
  # are missing, otherwise it would try to run the app (not done in tests).
  skip_if(requireNamespace("shiny", quietly = TRUE) &&
            requireNamespace("bslib", quietly = TRUE) &&
            requireNamespace("DT", quietly = TRUE),
          "UI deps installed; skip the missing-deps path")
  expect_error(launch_rfair(), "is required to run the rfair app")
})

Try the rfair package in your browser

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

rfair documentation built on July 1, 2026, 5:07 p.m.