tests/testthat/test_download_enso.R

context("Testing download_enso")

test_that("Does download_enso() download a data.frame?", {
  skip_on_cran()
  skip_if_no_internet()
  skip_if_shutdown()
  expect_is(download_enso(), "data.frame")
})


test_that("Does download_enso() save to a file?", {
  skip_on_cran()
  skip_if_no_internet()
  skip_if_shutdown()

  old <- setwd(tempdir())
  on.exit(setwd(old))
  expect_is(download_enso(create_csv = TRUE), "data.frame")
  expect_true(file.exists("ENSO_Index.csv"))
  setwd(old)
})

Try the rsoi package in your browser

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

rsoi documentation built on March 13, 2026, 9:07 a.m.