tests/testthat/test_commonnames.R

context("common names")

test_that("test common to sci name", { 
  
  needs_api()
  species <- common_to_sci(
    c("Bicolor cleaner wrasse", "humphead parrotfish"),
    Language="English")
  expect_is(species$Species, "character")
  expect_gt(length(species$Species), 1)
  
  species <- common_to_sci("trout")
  expect_is(species, "data.frame")
  n <- length(species)
  
  species <- common_to_sci(c("trout", "Coho Salmon"))
  expect_is(species$Species, "character")
  expect_gt(length(species$Species), n)
})



test_that("test sci to common names", { 
  needs_api()
  df <- common_names(c("Labroides bicolor",  "Bolbometopon muricatum"))
  expect_is(df, "data.frame")
})

Try the rfishbase package in your browser

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

rfishbase documentation built on June 7, 2023, 6:14 p.m.