Skip to content

Commit

Permalink
✅ Add tests for data_package()
Browse files Browse the repository at this point in the history
Add a basic test for data_pacakge()
  • Loading branch information
ThierryO committed Dec 14, 2024
1 parent d677eaa commit 05a1379
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/testthat/test_e_data_package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
test_that("datapackage", {
root <- tempfile("datapackage")
dir.create(root)
write_vc(
x = test_data, file = "human_readable", root = root, optimize = FALSE,
sorting = "test_integer", digits = 4
)
expect_identical(
data_package(path = root), file.path(root, "datapackage.json")
)
write_vc(
x = test_data, file = "human_readable_meta", root = root, optimize = FALSE,
sorting = "test_integer", digits = 4
)
update_metadata(
file = "human_readable_meta", root = root, title = "Test title",
description = "Test description", name = "test",
field_description = c(
test_integer = "Test integer", test_numeric = "Test numeric",
test_character = "Test character", test_factor = "Test factor",
test_logical = "Test logical", test_Date = "Test date",
test_POSIXct = "Test POSIXct", test_ordered = "Test ordered"
)
)
expect_identical(
data_package(path = root), file.path(root, "datapackage.json")
)
})

0 comments on commit 05a1379

Please sign in to comment.