tests/testthat/test-predict.R

testthat::test_that("predict", {
  fit <- garma(runif(120))
  testthat::expect_error(
    predict(fit, n.ahead = (-1)),
    regexp = "The parameter 'n.ahead' must be an integer g.t. 0"
  )

  testthat::expect_error(
    predict(fit, n.ahead = 5, newdata = runif(5)),
    regexp = "You have provided the 'newdata' parameter but the original 'fit' did not include an xreg"
  )

  fit <- garma(runif(120), xreg = runif(120))
  testthat::expect_error(
    predict(fit, n.ahead = 5, newdata = runif(4)),
    regexp = "The length of newdata must be 5"
  )

})
rlph50/garma documentation built on June 8, 2025, 3:15 a.m.