diff --git a/tests/testthat/test-plot_with_settings.R b/tests/testthat/test-plot_with_settings.R index c3b77192..70a0a178 100644 --- a/tests/testthat/test-plot_with_settings.R +++ b/tests/testthat/test-plot_with_settings.R @@ -233,9 +233,7 @@ testthat::test_that("type_download_srv download all types of files and change th }) testthat::test_that("type_download_srv downloads a png file with different dimensions", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") shiny::testServer( teal.widgets:::type_download_srv, @@ -252,9 +250,7 @@ testthat::test_that("type_download_srv downloads a png file with different dimen }) testthat::test_that("type_download_srv downloads a png file using default dimensions input dimensions are NULL", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") shiny::testServer( teal.widgets:::type_download_srv, @@ -317,9 +313,8 @@ plot_with_settings_args <- list( ) testthat::test_that("plot_with_settings_srv set dimensions and download a png file - base", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") + plot_with_settings_args$plot_r <- function() plot(1) shiny::testServer( teal.widgets:::plot_with_settings_srv, @@ -342,9 +337,7 @@ testthat::test_that("plot_with_settings_srv set dimensions and download a png fi }) testthat::test_that("plot_with_settings_srv set dimensions and download a png file - ggplot2", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") plot_with_settings_args$plot_r <- function() { ggplot2::ggplot(mtcars, ggplot2::aes(mpg, wt)) + @@ -371,9 +364,7 @@ testthat::test_that("plot_with_settings_srv set dimensions and download a png fi }) testthat::test_that("plot_with_settings_srv set dimensions and download a png file - grob", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") plot_with_settings_args$plot_r <- function() { ggplot2::ggplotGrob( @@ -402,9 +393,7 @@ testthat::test_that("plot_with_settings_srv set dimensions and download a png fi }) testthat::test_that("plot_with_settings_srv set dimensions and download a png file - trellis", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") plot_with_settings_args$plot_r <- function() { lattice::densityplot(1) @@ -430,9 +419,7 @@ testthat::test_that("plot_with_settings_srv set dimensions and download a png fi }) testthat::test_that("plot_with_settings_srv set dimensions and download a png file - WRONG type", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") plot_with_settings_args$plot_r <- function() 2 @@ -469,9 +456,7 @@ testthat::test_that("plot_with_settings_srv expand no error", { }) testthat::test_that("plot_with_settings_srv set dimensions and download a png file from modal", { - if (!require("png", quietly = TRUE)) { - skip("png package not available") - } + testthat::skip_if_not_installed("png") plot_with_settings_args[["plot_r"]] <- function() plot(1) shiny::testServer(