2018-06-26 05:48:55 +02:00
|
|
|
context("CSV Exports")
|
|
|
|
|
|
|
|
# Set up the path and data -------------------------------------------------
|
|
|
|
metadata <- read.csv(
|
2018-06-28 23:20:14 +02:00
|
|
|
get_data_location(
|
2018-06-26 05:48:55 +02:00
|
|
|
"ExampleProject_DataDictionary_2018-06-07.csv"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
records <- read.csv(
|
2018-06-28 23:20:14 +02:00
|
|
|
get_data_location(
|
2018-06-26 05:48:55 +02:00
|
|
|
"ExampleProject_DATA_2018-06-07_1129.csv"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Test that basic CSV export matches reference ------------------------------
|
|
|
|
test_that("CSV export matches reference", {
|
|
|
|
redcap_output_csv1 <- REDCap_split(records, metadata)
|
|
|
|
|
|
|
|
expect_known_hash(redcap_output_csv1, "f74558d1939c17d9ff0e08a19b956e26")
|
|
|
|
})
|
|
|
|
|
|
|
|
# Test that R code enhanced CSV export matches reference --------------------
|
2018-06-28 23:20:14 +02:00
|
|
|
if (requireNamespace("Hmisc", quietly = TRUE)) {
|
|
|
|
test_that("R code enhanced export matches reference", {
|
|
|
|
redcap_output_csv2 <- REDCap_split(REDCap_process_csv(records), metadata)
|
2018-06-26 05:48:55 +02:00
|
|
|
|
2018-06-28 23:20:14 +02:00
|
|
|
expect_known_hash(redcap_output_csv2, "34f82cab35bf8aae47d08cd96f743e6b")
|
|
|
|
})
|
|
|
|
}
|
2018-06-26 05:48:55 +02:00
|
|
|
|