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 cfc5507
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: BacDiveR
Title: A Programmatic Interface For BacDive, The DSMZ's Bacterial Diversity Metadatabase.
Version: 0.3.0
Version: 0.3.1
Authors@R: person("Katrin", "Leinweber", email = "katrin.leinweber@tib.eu", role = c("aut", "cre"))
Description: BacDive focuses on providing organism-linked information covering the multifarious aspects of bacterial biodiversity: taxonomic classification, morphology, physiology, cultivation, origin natural habitat and more, both for bacterial and archeal strains. BacDiveR helps you investigate this data offline, and semi-automatically in R.
License: MIT + file LICENSE
Expand Down
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
13 changes: 13 additions & 0 deletions tests/testthat/test-retrieve_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ test_that("using the taxon search for a single dataset works", {
})


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


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

0 comments on commit cfc5507

Please sign in to comment.