tests/testthat/test-mod_data_selection.R

context("mod data selection")

library(golem)

test_that("app ui", {
  ui <- mod_data_selection_ui("data_selection_ui")
  expect_shinytaglist(ui)
})

test_that("app server", {
  server <- app_server
  expect_is(mod_data_selection_server, "function")
})

testServer(mod_data_selection_server, args = list(r = reactiveValues()), {
  
  hotr <- list(data = data.frame(col1 = c("a", "b", "c"),
                                 col2 = c(1, 2, 3),
                                 stringsAsFactors = FALSE),
               dic = data.frame(hdType = c("Cat", "Num"),
                                label = c("col1", "col2"),
                                id = c("a", "b"),
                                stringsAsFactors = FALSE),
               selected = NULL)

  session$setInputs(hotr_input = hotr)

  expect_equal(as.character(data_fringe()$frtype), "Cat-Num")
  
})
datasketch/DSAppTemplate documentation built on March 4, 2021, 12:49 a.m.