mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-21 14:09:08 +02:00
Introducing framework for testthat tests
This commit is contained in:
parent
4f2974701c
commit
4d6ee65d98
6 changed files with 4154 additions and 4 deletions
20
R/tests/testthat/test-longitudinal.R
Normal file
20
R/tests/testthat/test-longitudinal.R
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
context("Longitudinal data")
|
||||
|
||||
test_that("CSV export matches reference", {
|
||||
# Reading in the files
|
||||
file_paths <- file.path(
|
||||
system.file("tests", "testthat", "data", package = "REDCapRITS"),
|
||||
c(
|
||||
records = "WARRIORtestForSoftwa_DATA_2018-06-21_1431.csv",
|
||||
metadata = "WARRIORtestForSoftwareUpgrades_DataDictionary_2018-06-21.csv"
|
||||
)
|
||||
)
|
||||
|
||||
redcap <- lapply(file_paths, read.csv, stringsAsFactors = FALSE)
|
||||
names(redcap) <- c("records", "metadata")
|
||||
redcap[["metadata"]] <- with(redcap, metadata[metadata[,1] > "",])
|
||||
redcap_output <- with(redcap, REDCap_split(records, metadata))
|
||||
|
||||
|
||||
expect_known_hash(redcap_output, "dff3a52955")
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue