Skip to content

Commit

Permalink
dedicate a test file to a single function
Browse files Browse the repository at this point in the history
  • Loading branch information
wibeasley committed Jan 3, 2020
1 parent 63d1ce2 commit 041f42f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
21 changes: 21 additions & 0 deletions tests/testthat/tests-get_file.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
context("Data Access API")

# See https://demo.dataverse.org/dataverse/dataverse-client-r
# https://doi.org/10.70122/FK2/FAN622

test_that("download file from DOI and filename", {
actual <- get_file(
file = "roster-bulls-1996.tab",
dataset = "doi:10.70122/FK2/FAN622"
)
expect_true(is.raw(actual))
expect_true(1000 < object.size(actual)) # Should be 1+ KB
})

test_that("download file from file id", {
actual <- get_file(
file = 396357
)
expect_true(is.raw(actual))
expect_true(1000 < object.size(actual)) # Should be 1+ KB
})
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,3 @@ test_that("get file metadata from file id", {
expect_true(is.character(actual))
expect_true(4000 < nchar(actual)) # There should be 4k+ characters
})

test_that("download file from DOI and filename", {
actual <- get_file(
file = "roster-bulls-1996.tab",
dataset = "doi:10.70122/FK2/FAN622"
)
expect_true(is.raw(actual))
expect_true(1000 < object.size(actual)) # Should be 1+ KB
})

test_that("download file from file id", {
actual <- get_file(
file = 396357
)
expect_true(is.raw(actual))
expect_true(1000 < object.size(actual)) # Should be 1+ KB
})

0 comments on commit 041f42f

Please sign in to comment.