tests/testthat/test-online.R

test_that("Test error online", {
  skip_on_cran()
  skip_if_offline()

  img <- "http://this_is_an_error_url.fake"
  x <- sf::st_read(system.file("gpkg/UK.gpkg", package = "rasterpic"),
    quiet = TRUE
  )

  expect_error(rasterpic_img(x, img))
})

test_that("Test image online", {
  skip_on_cran()
  skip_if_offline()

  img <- "https://i.imgur.com/6yHmlwT.jpeg"
  x <- sf::st_read(system.file("gpkg/UK.gpkg", package = "rasterpic"),
    quiet = TRUE
  )

  expect_silent(rasterpic_img(x, img))
})

Try the rasterpic package in your browser

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

rasterpic documentation built on Sept. 8, 2023, 5:54 p.m.