diff --git a/tests/testthat/tests-get_file.R b/tests/testthat/tests-get_file.R new file mode 100644 index 0000000..3ef5511 --- /dev/null +++ b/tests/testthat/tests-get_file.R @@ -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 +}) diff --git a/tests/testthat/tests-data-access.R b/tests/testthat/tests-get_file_metadata.R similarity index 58% rename from tests/testthat/tests-data-access.R rename to tests/testthat/tests-get_file_metadata.R index e2a872a..2bb7ab6 100644 --- a/tests/testthat/tests-data-access.R +++ b/tests/testthat/tests-get_file_metadata.R @@ -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 -})