context("leaflet")
test_that('eq_map creates leaflet map', {
leaflet_map <-
eq_clean_data(earthquakes) %>%
eq_location_clean() %>%
dplyr::filter(COUNTRY == "MEXICO" & lubridate::year(DATE) >= 2000) %>%
eq_map(annot_col = "DATE")
expect_s3_class(leaflet_map, 'leaflet')
expect_s3_class(leaflet_map, 'htmlwidget')
})
test_that('eq_create_label handles NA', {
df <- data.frame(
LOCATION_NAME = c(1:2, NA),
EQ_PRIMARY = c(5, NA, 8),
TOTAL_DEATHS = c(NA, NA, 1)
)
label_col <- eq_create_label(df, label_col = "popup_text")[["popup_text"]]
expect_equal(which(grepl("Location", label_col)), c(1, 2))
expect_equal(which(grepl("Magnitude", label_col)), c(1, 3))
expect_equal(which(grepl("Total death", label_col)), 3)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.