tests/testthat/test-vignettes.R

#' @title Specifications test-vignettes.R
#' @section Last updated by: Tim Treis (tim.treis@@outlook.de)
#' @section Last update date: 2022-03-01T16:22:07
#'
#' @section List of tested specifications
#' T1. Data loaded from external sources exists.
#' T1.1 Data from Bankar et al. is still hosted on GitHub.

# Requirement T1 ----------------------------------------------------------

testthat::context("vignettes - T1. Data loaded from external sources exists.")

testthat::test_that("T1.1 Data from Bankar et al. is still hosted on GitHub.", {

  # Our interactive vignette loads public data so that people can follow along
  # This test ensures that it is still publicly available

  bankar_link <- "https://raw.githubusercontent.com/vntkumar8/covid-survival/main/data/final.csv"

  check <- suppressWarnings(
    try(
      open.connection(
        url(bankar_link),
        timeout = 5
      ),
      silent = TRUE
    )[1]
  )

  suppressWarnings(
    try(
      close.connection(url(bankar_link)),
      silent = TRUE
    )
  )

  testthat::expect_true(is.null(check))
})

# END OF CODE -------------------------------------------------------------

Try the visR package in your browser

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

visR documentation built on Nov. 21, 2023, 1:07 a.m.