tests/testthat/test-prophet-guard.R

test_that("prophet_available() reflects whether prophet is installed", {
  expect_equal(prophet_available(), .pkg_installed("prophet"))
})

test_that("prophet fit fails with a clear, actionable message when prophet is missing", {
  skip_if(.pkg_installed("prophet"), "prophet is installed in this environment")
  m <- get_model("prophet")
  expect_error(
    m$fit(data.frame(ds = Sys.Date() - 30:1, y = rnorm(30))),
    "prophet"
  )
})

test_that("library(forecastsuite) never errors even without prophet", {
  # Loading the package must not fail just because an optional Suggests
  # dependency is absent -- only *calling* the prophet fit function should.
  expect_true(exists("get_model"))
  expect_no_error(get_model("prophet"))
})

Try the forecastsuite package in your browser

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

forecastsuite documentation built on Oct. 18, 2026, 5:08 p.m.