tests/testthat/test-finbif_informal_groups.R

test_that("fetching informal groups works", {

  skip_on_cran()

  op <- options()

  cache <- tempfile()

  dir.create(cache)

  options(finbif_cache_path = cache, finbif_rate_limit = Inf)

  if (requireNamespace("vcr", quietly = TRUE)) {

    vcr::use_cassette("finbif_informal_groups", {

      limit <- capture.output(finbif_informal_groups(limit = 1, locale = "ru"))

      bryophytes <- capture.output(finbif_informal_groups("Bryophytes"))

    })

    expect_equal(
      limit,
      c(
        "Birds",
        "  --Birds of prey and owls",
        "      --Owls",
        "      --Birds of prey",
        "  --Waterbirds",
        "...153 more groups"
      )
    )

    expect_equal(
      bryophytes,
      c("Bryophytes", "  --Mosses", "  --Liverworts", "  --Hornworts")
    )

  }

  options(finbif_cache_path = NULL)

  options(op)

})

Try the finbif package in your browser

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

finbif documentation built on Jan. 27, 2026, 9:06 a.m.