tests/testthat/test-select.R

test_that("Select UI is generated and working correctly", {
  testthat::expect_equal(class(select_ui), "function")
  testthat::expect_s3_class(select_ui("test"), "shiny.tag")
})

# See ?testServer for more information
test_that("Select Server is generated and working correctly", {
  shiny::testServer(select_server, {
    # Set initial value of a button
    cat("Initially, selected input is NULL, right?", is.null(input$select),"\n")
    session$setInputs(select = "Test Selection")
    cat("Just set the value of the select to 'Test Selection'? ",input$select == "Test Selection","\n")
    expect_equal(input$select, "Test Selection")
    session$setInputs(select = "Test Selection 1")
    cat("Just set the value of the select to 'Test Selection 1'? ",input$select == "Test Selection 1","\n")
    expect_equal(input$select, "Test Selection 1")
  })
})
HarryRosen/hrimodules documentation built on Jan. 11, 2022, 12:36 a.m.