tests/testthat/test-plot_and_summary_methods.R

context("Plot & Summary methods")

library(dplyr)

data(EmplUK, package = "plm")
EmplUK <- dplyr::filter(EmplUK, year %in% c(1978, 1979, 1980, 1981, 1982))

test_that("plot method works", {
  model <- pmpp(dep_var = "emp", data = EmplUK)
  myplot <- plot(model)

  expect_true("ggplot" %in% class(myplot))
})

test_that("summary method works", {
  model <- pmpp(dep_var = "emp", data = EmplUK)
  invisible(
    capture.output(
      mysummary <- summary(model)
    )
  )

  expect_true("data.frame" %in% class(mysummary))
  expect_equal(
    as.vector(mysummary[[1]]),
    c(
      "RMSE (in-sample):", "MAPE (in-sample):",
      "Residuals normality p-value (H0: normal):"
    )
  )
})

Try the pmpp package in your browser

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

pmpp documentation built on Oct. 30, 2019, 11:35 a.m.