tests/testthat/test-networking.R

test_that("online() works as expected", {
  expect_equal(online(), curl::has_internet())

  skip_if_offline()
  expect_true(online())
})

test_that("using_host() works as expected", {
  expect_true(using_host(Sys.info()["nodename"]))
  expect_false(using_host("notarealhostname.biz"))
})

Try the ami package in your browser

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

ami documentation built on April 4, 2025, 2:39 a.m.