|
| 1 | +test_that("tm_g_association fails initially", { |
| 2 | + |
| 3 | + data <- within(teal_data(), { |
| 4 | + require(nestcolor) |
| 5 | + CO2 <- CO2 |
| 6 | + factors <- names(Filter(isTRUE, vapply(CO2, is.factor, logical(1L)))) |
| 7 | + CO2[factors] <- lapply(CO2[factors], as.character) |
| 8 | + }) |
| 9 | + |
| 10 | + module <- tm_g_association( |
| 11 | + ref = data_extract_spec( |
| 12 | + dataname = "CO2", |
| 13 | + select = select_spec( |
| 14 | + label = "Select variable:", |
| 15 | + choices = variable_choices("CO2", c("Plant", "Type", "Treatment")), |
| 16 | + selected = "Plant", |
| 17 | + fixed = FALSE |
| 18 | + ) |
| 19 | + ), |
| 20 | + vars = data_extract_spec( |
| 21 | + dataname = "CO2", |
| 22 | + select = select_spec( |
| 23 | + label = "Select variables:", |
| 24 | + choices = variable_choices("CO2", c("Plant", "Type", "Treatment")), |
| 25 | + selected = "Treatment", |
| 26 | + multiple = TRUE, |
| 27 | + fixed = FALSE |
| 28 | + ) |
| 29 | + ) |
| 30 | + ) |
| 31 | + |
| 32 | + args <- formals(tm_g_association) |
| 33 | + |
| 34 | + args$ref <- data_extract_spec( |
| 35 | + dataname = "CO2", |
| 36 | + select = select_spec( |
| 37 | + label = "Select variable:", |
| 38 | + choices = variable_choices("CO2", c("Plant", "Type", "Treatment")), |
| 39 | + selected = "Plant", |
| 40 | + fixed = FALSE |
| 41 | + ) |
| 42 | + ) |
| 43 | + args$vars <- data_extract_spec( |
| 44 | + dataname = "CO2", |
| 45 | + select = select_spec( |
| 46 | + label = "Select variables:", |
| 47 | + choices = variable_choices("CO2", c("Plant", "Type", "Treatment")), |
| 48 | + selected = "Treatment", |
| 49 | + multiple = TRUE, |
| 50 | + fixed = FALSE |
| 51 | + ) |
| 52 | + ) |
| 53 | + args$id <- "test" |
| 54 | + args$data <- reactive(data) |
| 55 | + args <- lapply(args, eval) |
| 56 | + testServer(module$server, |
| 57 | + args = args[names(formals(module$server))], |
| 58 | + expr = { |
| 59 | + expect_error(output_q()) |
| 60 | + } |
| 61 | + ) |
| 62 | +}) |
0 commit comments