tests/testthat/test_endpoint.R

test_that("we can create endpoints with closures", {
  example <- endpoint("species")
  expect_is(example, "function")
})

test_that("Custom queries give desired result", {
  needs_api()
  country <- endpoint("country")
  df <- country()
  expect_is(df, "tbl")

  df <- country("Oreochromis niloticus")
  expect_is(df, "tbl")

  # null byte issue
  #references()
  #rr <- references(codes = c("1", "4"))
  #expect_is(rr, "tbl")
  #expect_equal(nrow(rr), 2)
})

Try the rfishbase package in your browser

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

rfishbase documentation built on Dec. 17, 2025, 9:06 a.m.