Skip to content

Commit

Permalink
Finishes tests for #70, #107
Browse files Browse the repository at this point in the history
  • Loading branch information
kuriwaki committed Dec 24, 2021
1 parent 007cb7e commit f1338f8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
5 changes: 3 additions & 2 deletions R/get_dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@
#' tmp[[ls(tmp)[1]]]
#' }
#'
#' as_rda <- get_dataframe_by_doi(
#' filedoi = "doi:10.70122/FK2/PPIAXE/5VPXKE",
#' # https://demo.dataverse.org/file.xhtml?persistentId=doi:10.70122/FK2/PPIAXE/X2FC5V
#' as_rda <- get_dataframe_by_id(
#' file = 1939003,
#' server = "demo.dataverse.org",
#' .f = load_object,
#' original = TRUE)
Expand Down
5 changes: 3 additions & 2 deletions man/get_dataframe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions tests/testthat/tests-get_dataframe-dataframe-basketball.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,23 @@ test_that("roster-by-id", {

expect_equal(actual, expected_file)
})

test_that("load-rdata", {
# testthat::skip_if_offline("demo.dataverse.org")
testthat::skip_on_cran()

# https://stackoverflow.com/a/34926943
f_load_rda <- function(file) {
tmp <- new.env()
load(file = file, envir = tmp)
tmp[[ls(tmp)[1]]]
}

from_rda <- get_dataframe_by_id(
file = 1939003,
server = "demo.dataverse.org",
.f = f_load_rda,
original = TRUE)

expect_s3_class(from_rda, "tbl")
})

0 comments on commit f1338f8

Please sign in to comment.