Skip to content

Commit

Permalink
skeleton for tm_outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Apr 16, 2024
1 parent 78b95ac commit 21b95de
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/testthat/helper-TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,50 @@ simple_cdisc_data <- function(datasets = c("ADSL", "ADRS", "ADTTE")) {
teal.data::join_keys(data) <- teal.data::default_cdisc_join_keys[datasets]
data
}

app_driver_tm_outlier <- function() {
data <- teal.data::teal_data()
data <- within(data, {
CO2 <- CO2 # nolint: object_name
CO2[["primary_key"]] <- seq_len(nrow(CO2))
})
teal.data::datanames(data) <- "CO2"
teal.data::join_keys(data) <- teal.data::join_keys(join_key("CO2", "CO2", "primary_key"))

vars <- teal.transform::choices_selected(teal.transform::variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")))

TealAppDriver$new(
data = data,
modules = tm_outliers(
outlier_var = list(
teal.transform::data_extract_spec(
dataname = "CO2",
select = teal.transform::select_spec(
label = "Select variable:",
choices = teal.transform::variable_choices(data[["CO2"]], c("conc", "uptake")),
selected = "uptake",
multiple = FALSE,
fixed = FALSE
)
)
),
categorical_var = list(
teal.transform::data_extract_spec(
dataname = "CO2",
filter = teal.transform::filter_spec(
vars = vars,
choices = teal.transform::value_choices(data[["CO2"]], vars$selected),
selected = teal.transform::value_choices(data[["CO2"]], vars$selected),
multiple = TRUE
)
)
),
ggplot2_args = list(
teal.widgets::ggplot2_args(
labs = list(subtitle = "Plot generated by Outliers Module")
)
)
)

)
}
7 changes: 7 additions & 0 deletions tests/testthat/test-shinytest2-tm_outliers.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
testthat::test_that("e2e - tm_outliers: skeleton", {
skip_if_too_deep(5)

app <- app_driver_tm_outlier()
app$expect_no_shiny_error()
app$stop()
})

0 comments on commit 21b95de

Please sign in to comment.