tests/testthat/test-eol_pages.R

context("eol_pages")

test_that("eol_pages returns the correct value and classes", {
  skip_on_cran()

  vcr::use_cassette("eol_pages", {
    pageid <- suppressMessages(eol_search('Pomatomus'))$pageid[1]
    pageid2 <- suppressMessages(eol_search('Helianthus'))$pageid[1]
    aa <- suppressMessages(eol_pages(taxonconceptID = pageid))
  }, preserve_exact_body_bytes = TRUE)

  expect_is(aa, "list")
  expect_is(aa$scinames, "data.frame")
  expect_null(aa$synonyms)
  expect_named(aa, c('scinames', 'synonyms', 'vernacular', 'refs', 'data_objects'))

  vcr::use_cassette("eol_pages2", {
  	bb <- suppressMessages(eol_pages(taxonconceptID = pageid2))
  }, preserve_exact_body_bytes = TRUE)

	expect_is(bb, "list")
	expect_is(bb$scinames, "data.frame")
	expect_null(bb$synonyms)
  expect_named(bb, c('scinames', 'synonyms', 'vernacular', 'refs', 'data_objects'))
})

Try the taxize package in your browser

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

taxize documentation built on Sept. 11, 2024, 6:13 p.m.