Skip to content

Commit

Permalink
Fix #45
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinleinweber committed Mar 24, 2018
1 parent 653ab35 commit ccd19b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/retrieve_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ retrieve_data <- function(searchTerm,

} else if (is.list(x) && length(x) == 1) {
# repeat download, if API returned a single ID, instead of a full dataset
x <- jsonlite::fromJSON(download(paste0(x[[1]][1]$url, "?format=json")))
x <- jsonlite::fromJSON(download(paste0(x[1]$url, "?format=json")))
return(x)
} else if (identical(x$detail, "Not found")) {
stop(
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-retrieve_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ test_that("using the taxon search for a single dataset works", {
})


test_that("downloading a single dataset via culturecollectionno works (#45)",
{
is.list(
retrieve_data(
searchTerm = "DSM 319",
searchType = "culturecollectionno",
force_taxon_download = TRUE
)
)
})


test_that("extracting a single field from a taxon-wide search works", {
expect_equal(30,
unique(unlist(
Expand Down

0 comments on commit ccd19b3

Please sign in to comment.