mirror of
https://github.com/agdamsbo/REDCapCAST.git
synced 2026-06-19 13:17:30 +02:00
preparing for next version
This commit is contained in:
parent
3e4b1b1549
commit
28beea676c
7 changed files with 109 additions and 28 deletions
29
tests/testthat/test-ds2dd.R
Normal file
29
tests/testthat/test-ds2dd.R
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
mtcars$id <- seq_len(nrow(mtcars))
|
||||
|
||||
test_that("ds2dd gives desired output", {
|
||||
expect_equal(ncol(ds2dd(mtcars, record.id = "id")), 18)
|
||||
expect_s3_class(ds2dd(mtcars, record.id = "id"), "data.frame")
|
||||
expect_s3_class(ds2dd(mtcars, record.id = 12), "data.frame")
|
||||
})
|
||||
|
||||
|
||||
test_that("ds2dd gives output with list of length two", {
|
||||
expect_equal(length(ds2dd(
|
||||
mtcars,
|
||||
record.id = "id",
|
||||
include.column.names = TRUE
|
||||
)), 2)
|
||||
})
|
||||
|
||||
|
||||
test_that("ds2dd gives correct errors", {
|
||||
expect_error(ds2dd(mtcars))
|
||||
expect_error(ds2dd(mtcars, form.name = c("basis", "incl")))
|
||||
expect_error(ds2dd(mtcars, field.type = c("text", "dropdown")))
|
||||
expect_error(ds2dd(mtcars, field.label = c("Name", "Age")))
|
||||
})
|
||||
|
||||
test_that("ds2dd correctly renames", {
|
||||
expect_equal(ncol(ds2dd(mtcars, record.id = "id")), 18)
|
||||
expect_s3_class(ds2dd(mtcars, record.id = "id"), "data.frame")
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue