From e7c4228e4aacf16d49f3a2031f46493c0cee31b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Apr 2024 18:35:52 +0530 Subject: [PATCH] @m7pr suggestions --- tests/testthat/helper-TealAppDriver.R | 25 ----------------- .../testthat/test-shinytest2-tm_data_table.R | 28 +++++++++++++++++-- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/tests/testthat/helper-TealAppDriver.R b/tests/testthat/helper-TealAppDriver.R index 13355d29e..39e5c28d9 100644 --- a/tests/testthat/helper-TealAppDriver.R +++ b/tests/testthat/helper-TealAppDriver.R @@ -27,28 +27,3 @@ simple_cdisc_data <- function(datasets = c("ADSL", "ADRS", "ADTTE")) { teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datasets] data } - -# local app drivers for module testing ---------------------------------------- -# based on examples - -app_driver_tm_data_table <- function() { - app <- TealAppDriver$new( - data = simple_teal_data(), - modules = tm_data_table( - label = "Data Table", - variables_selected = list( - iris = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species") - ), - datasets_selected = c("iris", "mtcars"), - dt_args = list(caption = "Table Caption"), - dt_options = list( - searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100), - scrollX = TRUE - ), - server_rendering = FALSE, - pre_output = NULL, - post_output = NULL - ), - timeout = 3000 - ) -} diff --git a/tests/testthat/test-shinytest2-tm_data_table.R b/tests/testthat/test-shinytest2-tm_data_table.R index 75113484e..33b8d29a3 100644 --- a/tests/testthat/test-shinytest2-tm_data_table.R +++ b/tests/testthat/test-shinytest2-tm_data_table.R @@ -1,4 +1,26 @@ -test_that("e2e: tm_front_page initializes without errors", { +app_driver_tm_data_table <- function() { + app <- TealAppDriver$new( + data = simple_teal_data(), + modules = tm_data_table( + label = "Data Table", + variables_selected = list( + iris = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species") + ), + datasets_selected = c("iris", "mtcars"), + dt_args = list(caption = "Table Caption"), + dt_options = list( + searching = FALSE, pageLength = 30, lengthMenu = c(5, 15, 30, 100), + scrollX = TRUE + ), + server_rendering = FALSE, + pre_output = NULL, + post_output = NULL + ), + timeout = 3000 + ) +} + +test_that("e2e: tm_data_table initializes without errors", { skip_if_too_deep(5) app_driver <- app_driver_tm_data_table() @@ -6,7 +28,7 @@ test_that("e2e: tm_front_page initializes without errors", { app_driver$stop() }) -test_that("e2e: tm_front_page displays data table", { +test_that("e2e: tm_data_table displays data table", { skip_if_too_deep(5) app_driver <- app_driver_tm_data_table() @@ -17,7 +39,7 @@ test_that("e2e: tm_front_page displays data table", { app_driver$stop() }) -test_that("e2e: tm_front_page variable selection", { +test_that("e2e: tm_data_table variable selection", { skip_if_too_deep(5) app_driver <- app_driver_tm_data_table()