tests/testthat/test-radio_buttons.R

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

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