tests/testthat/test-occCitePrint.R

library(occCite)
library(ape)

test_that("is occCitePrint working?", {
  skip_on_cran()
  treeFile <- system.file("extdata/Fish_12Tax_time_calibrated.tre",
                          package = "occCite")
  phylogeny <- ape::read.nexus(treeFile)
  tree <- ape::extract.clade(phylogeny, 22)
  # Query databases for names
  myPhyOccCiteObject <- studyTaxonList(
    x = tree,
    datasources = "GBIF Backbone Taxonomy"
  )
  # Query GBIF for occurrence data
  if (!is.null(myPhyOccCiteObject)) {
    myPhyOccCiteObject <- occQuery(
      x = myPhyOccCiteObject,
      datasources = "gbif",
      GBIFDownloadDirectory = system.file("extdata/", package = "occCite"),
      loadLocalGBIFDownload = T,
      checkPreviousGBIFDownload = F
    )
    myPhyOccCitations <- occCitation(myPhyOccCiteObject)

    test_that("regular print", {
      expect_output(print(myPhyOccCitations))
    })

    test_that("print by species", {
      expect_output(print(myPhyOccCitations, bySpecies = TRUE))
    })
  }
})

Try the occCite package in your browser

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

occCite documentation built on Aug. 5, 2022, 5:09 p.m.