R/helpers-testthat.R

Defines functions expect_gg

Documented in expect_gg

#' Check if an Object is a [ggplot2] Plot
#'
#' @description
#'   Use in tests to check if an object is a [ggplot2::ggplot] object.
#'
#' @param x [ggplot2::ggplot] object
#'
#' @note borrowed from `bayesplot:::expect_gg`
#'
expect_gg <- function(x) {
  testthat::expect_s3_class(x, "ggplot")
  invisible(ggplot2::ggplot_build(x))
}
maomlab/BayesPharma documentation built on Aug. 24, 2024, 8:45 a.m.