tests/testthat/test-mvt_fetch.R

context("mvt_fetch")

test_that("mvt_fetch", {
  skip_on_cran()
  skip_if_not_installed("protolite")
  skip_if_not_installed("sf")

  x <- mvt_fetch(taxonKey = 2480498, year = 2002)
  expect_is(x, "sf")
  expect_is(x$total, "numeric")
  expect_is(x$geometry, "sfc")
})

test_that("mvt_fetch fails well", {
  skip_on_cran()
  skip_if_not_installed("protolite")
  skip_if_not_installed("sf")

  expect_error(mvt_fetch(source = "stuff"), "is not TRUE")
  expect_error(mvt_fetch(source = 5), "source must be of class character")
})

Try the rgbif package in your browser

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

rgbif documentation built on May 29, 2024, 8:22 a.m.