Skip to contents

selectDataVarServer()

Test is.reactive() on data

shiny::testServer(selectDataVarServer, 
  args = list(filter = is.numeric), expr = {
    
  testthat::expect_true(
    object = is.reactive(data))
  test_cmt("selectDataVarServer", "is.reactive(data)")

})
#> Loading required package: shiny
#> 
#>     selectDataVarServer: is.reactive(data)

Test is.reactive() on var

shiny::testServer(selectDataVarServer, 
  args = list(filter = is.numeric), expr = {

  testthat::expect_true(
    object = is.reactive(var))
  test_cmt("selectDataVarServer", "is.reactive(var)")

})
#> 
#>     selectDataVarServer: is.reactive(var)

selectDataVarApp()

Test inputs for var-var-var

dv_app <- selectDataVarApp()
shiny::testServer(app = dv_app, expr = {
  session$setInputs(`var-var-var` = "Ozone",
                    `var-data-dataset` = "airquality")

  testthat::expect_equal(
    object = input$`var-var-var`,
    expected = "Ozone")
  test_cmt("selectDataVarApp", "input$`var-var-var`")

})
#> 
#>     selectDataVarApp: input$`var-var-var`

Test inputs for var-data-dataset

dv_app <- selectDataVarApp()
shiny::testServer(app = dv_app, expr = {
  session$setInputs(`var-var-var` = "Ozone",
                    `var-data-dataset` = "airquality")

  testthat::expect_equal(
    object = input$`var-data-dataset`,
    expected = "airquality")
  test_cmt("selectDataVarApp", "input$`var-data-dataset`")

})
#> 
#>     selectDataVarApp: input$`var-data-dataset`

Test is.reactive() for var

dv_app <- selectDataVarApp()
shiny::testServer(app = dv_app, expr = {
  session$setInputs(`var-var-var` = "Ozone",
                    `var-data-dataset` = "airquality")

  testthat::expect_true(object = is.reactive(var))
  test_cmt("selectDataVarApp", "is.reactive(var)")

})
#> 
#>     selectDataVarApp: is.reactive(var)