From cbe664d10ad56ff17e817205f05eada4acdebebf Mon Sep 17 00:00:00 2001 From: vedhav Date: Thu, 25 Jan 2024 11:41:19 +0530 Subject: [PATCH 1/2] fix: run verification check when check is `TRUE` --- R/teal_data.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/teal_data.R b/R/teal_data.R index 5e37ba35a..ed48f627a 100644 --- a/R/teal_data.R +++ b/R/teal_data.R @@ -52,10 +52,14 @@ teal_data <- function(..., if (length(data_objects) > 0 && !checkmate::test_names(names(data_objects), type = "named")) { stop("Dot (`...`) arguments on `teal_data()` must be named.") } - new_teal_data( + data <- new_teal_data( data = data_objects, code = code, join_keys = join_keys ) } + if (check) { + data <- verify(data) + } + return(data) } From 740aae7549fe1add8c590003ac03e0775fefb72b Mon Sep 17 00:00:00 2001 From: vedhav Date: Thu, 25 Jan 2024 12:06:59 +0530 Subject: [PATCH 2/2] fix: fix broken unit test --- tests/testthat/test-cdisc_data.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-cdisc_data.R b/tests/testthat/test-cdisc_data.R index bccb68c07..c69559a8b 100644 --- a/tests/testthat/test-cdisc_data.R +++ b/tests/testthat/test-cdisc_data.R @@ -1,7 +1,11 @@ testthat::test_that("cdisc_data returns teal_data object for objects different than old api", { adsl_raw <- as.data.frame(as.list(stats::setNames(nm = default_cdisc_join_keys["ADSL", "ADSL"]))) testthat::expect_s4_class( - teal_data(adsl = adsl_raw, check = TRUE), + cdisc_data(adsl = adsl_raw, check = FALSE), + "teal_data" + ) + testthat::expect_s4_class( + cdisc_data(i = iris, code = "i <- iris", check = TRUE), "teal_data" ) })