mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-21 14:09:08 +02:00
Writing unit tests for basic examples of data export for R.
This commit is contained in:
parent
ef4819e1fc
commit
4841e1170e
9 changed files with 1932 additions and 6 deletions
32
R/tests/testthat/test-API.R
Normal file
32
R/tests/testthat/test-API.R
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
context("Reading in JSON")
|
||||
|
||||
# Set up the path ----------------------------------------------------------
|
||||
|
||||
data_dir <- system.file("tests", "testthat", "data", package = "REDCapRITS")
|
||||
|
||||
# Check the RCurl export ---------------------------------------------------
|
||||
test_that("JSON character vector from RCurl matches reference", {
|
||||
|
||||
metadata <- jsonlite::fromJSON(
|
||||
file.path(
|
||||
data_dir,
|
||||
"ExampleProject_metadata.json"
|
||||
)
|
||||
)
|
||||
|
||||
records <- jsonlite::fromJSON(
|
||||
file.path(
|
||||
data_dir,
|
||||
"ExampleProject_records.json"
|
||||
)
|
||||
)
|
||||
|
||||
redcap_output_json1 <- REDCap_split(records, metadata)
|
||||
|
||||
expect_known_hash(redcap_output_json1, "2c8b6531597182af1248f92124161e0c")
|
||||
|
||||
})
|
||||
|
||||
# Check the httr export ---------------------------------------------------
|
||||
|
||||
# Something will go here.
|
||||
Loading…
Add table
Add a link
Reference in a new issue