tests/testthat/test-country_codes.r

context("rgb_country_codes")

test_that("returns the correct class", {
  skip_on_cran()
  
  expect_is(rgb_country_codes(country_name="United"), "data.frame")
  expect_is(rgb_country_codes(country_name="the", fuzzy=TRUE), "data.frame")
})

test_that("returns the correct value", {
  skip_on_cran()
  
  expect_equal(as.character(rgb_country_codes(country_name="United States")[2,"name"]), 
               "United States")
  expect_equal(as.character(rgb_country_codes(country_name="the", 
                                          fuzzy=TRUE)[2,"name"]), 
               "Saint Barthalemy")
})

Try the rgbif package in your browser

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

rgbif documentation built on July 7, 2018, 9:03 a.m.