tests/testthat/test-ebirdnotable.R

context("ebirdnotable")

test_that("ebirdnotable works correctly", {
  skip_on_cran()
  
  out <- ebirdnotable(lat=42, lng=-70, max = 40)
  expect_is(out, "data.frame")
  expect_equal(dim(out), c(40,13))
  expect_is(out$comName, "character")
  expect_is(out$howMany, "integer")

  expect_equal(NCOL(ebirdnotable(region='US-OH', regtype='subnational1')), 13)
  
  simpler <- ebirdnotable(lat=42, lng=-70, max = 40, simple = TRUE)
#   lesssimpler <- ebirdnotable(lat=42, lng=-70, max = 40, simple = FALSE)
  expect_equal(dim(simpler), c(40,13))
#   expect_equal(dim(lesssimpler), c(40,24))
  
  expect_gt(
    system.time(ebirdnotable(lat=42, lng=-70, max = 10, sleep = 1))[[3]]
    , 1)
})

Try the rebird package in your browser

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

rebird documentation built on Sept. 20, 2021, 9:06 a.m.