tests/testthat/test-reachability.R

test_that("reachability", {

  Sys.setenv("OPRS" = 'Your_API_Key')

  m <- leaflet() %>%
    addReachability()
  expect_is(m, "leaflet")

  deps <- findDependencies(m)
  expect_equal(deps[[length(deps)]]$name, "lfx-reachability")
  expect_equal(m$x$calls[[length(m$x$calls)]]$method,
               "addReachability")

  m <- m %>%
    removeReachability()
  expect_equal(m$x$calls[[length(m$x$calls)]]$method,
               "removeReachability")


})

test_that("reachability-error", {
  Sys.unsetenv("OPRS")

  expect_error(
    leaflet()  %>%
      addReachability()
  )

})

Try the leaflet.extras2 package in your browser

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

leaflet.extras2 documentation built on Aug. 21, 2023, 5:08 p.m.