Skip to content

Commit

Permalink
checklist bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterprovoost committed Jul 1, 2019
1 parent 6cf0622 commit 4e48955
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
@@ -1,8 +1,8 @@
Package: robis
Title: Ocean Biogeographic Information System (OBIS) Client
Description: Client for the Ocean Biogeographic Information System (<https://obis.org>).
Version: 2.1.10
Date: 2019-06-17
Version: 2.1.11
Date: 2019-07-01
Authors@R: c(
person("Pieter", "Provoost", , "pieterprovoost@gmail.com", c("cre", "aut")),
person("Samuel", "Bosch", , "mail@samuelbosch.com", role = "aut"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
@@ -1,3 +1,7 @@
# robis 2.1.11

Bugfix for checklist of unknown taxon.

# robis 2.1.10

Added hab parameter for IOC-UNESCO HAB species.
Expand Down
2 changes: 1 addition & 1 deletion R/checklist.R
Expand Up @@ -77,7 +77,7 @@ checklist <- function(
res <- fromJSON(text, simplifyVector = TRUE)
total <- res$total
partition = partition + 1
if (partition >= res$partitions) {
if (!("partitions" %in% names(res)) || partition >= res$partitions) {
last_page <- TRUE
}

Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test_checklist.R
Expand Up @@ -5,6 +5,7 @@ family <- "Pectinariidae"
family_taxa_lower_limit <- 10
family_taxa_upper_limit <- 1000
redlist_area <- 21
unknown_aphiaid <- 999999999

test_that("scientificname restricts the checklist by scientificname", {
taxa <- checklist(scientificname = family, verbose = TRUE)
Expand All @@ -17,3 +18,9 @@ test_that("checklist only returns taxa with IUCN Red List category when redlist
taxa <- checklist(areaid = redlist_area, redlist = TRUE, verbose = TRUE)
expect_true(all(!is.na(taxa$category)))
})

test_that("checklist for an unknown Aphia ID is empty", {
taxa <- checklist(taxonid = unknown_aphiaid)
expect_true(is.data.frame(taxa))
expect_true(nrow(taxa) == 0)
})

0 comments on commit 4e48955

Please sign in to comment.