tests/testthat/test-package_check.R

library(testthat)
library(shiny)

test_that("package_check returns FALSE for missing packages and shows error notification", {
  # Mock requireNamespace to simulate a missing package
  local_mocked_bindings(showNotification = function(...) {})  # Mock showNotification to avoid actual notifications

  expect_false(package_check("nonexistentpkg"))
})

test_that("package_check returns TRUE for existing packages", {
  # Mock requireNamespace to simulate a missing package
  local_mocked_bindings(showNotification = function(...) {})  # Mock showNotification to avoid actual notifications

  expect_true(package_check("testthat"))
})

Try the pdfcombiner package in your browser

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

pdfcombiner documentation built on Sept. 9, 2025, 5:56 p.m.