test_that("Testing the vessel module", {
# Fake datasets
marine_stats1 <- data.frame(vessel_type = c("A", "A", "B"), vessel_name = c("name_1", "name_2", "name_3"))
marine_stats2 <- list(vessel_type = c("A", "A", "B"))
# Vessel type must appear in the marine_stats
shiny::testServer(select_vessel_server, args = list(marine_stats = marine_stats1), {
session$setInputs(vessel_type = "A")
expect_equal(is.null(output$vessel_name_btn), FALSE)
})
# Vessel type must appear in the marine_stats
shiny::testServer(select_vessel_server, args = list(marine_stats = marine_stats1), {
session$setInputs(vessel_type = "D")
expect_null(output$vessel_name_btn)
})
# marine_stats must be a data.frame
shiny::testServer(select_vessel_server, args = list(marine_stats = marine_stats2), {
session$setInputs(vessel_type = "A")
expect_error(output$vessel_name_btn)
})
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.