tests/testthat/test-produce_zenodo_record.R

message("\n---- Test get_zenodo_data() ----")

library(testthat)

test_that("Expect error if internet connection is down", {
  testthat::expect_error(
    httptest::without_internet(
      result <- ReLTER::get_zenodo_data(
        doi = "10.5281/zenodo.7041152", # test dataset
        rdata_exist = FALSE
      )
    ),
    "GET"
  )
})

test_that("The input is not a Zenodo DOI (but DOI) constructs a NULL object", {
  result <- ReLTER::get_zenodo_data(
    doi = "10.1109/5.771073", # test dataset
    rdata_exist = FALSE
  )
  expect_type(result, "NULL")
})
oggioniale/ReLTER documentation built on Jan. 4, 2024, 3:48 p.m.