tests/testthat/test-geom_timeline_label.R

context("Test file for geom_timeline_label()")
require(magrittr)

df <- system.file("extdata", "earthquakes.tsv", package = "NOAAearthquake")
df1 <- eq_clean_data(df)
df2 <- eq_location_clean(df1) %>% 
  dplyr::filter(Country %in% c("Mexico", "Turkey"), lubridate::year(Date) > 2000) %>% 
  ggplot2::ggplot(ggplot2::aes(x = Date, y = Country, color = `Total Deaths`, size = `Mag`)) +
  geom_timeline() +
  theme_timeline()

test_that("geom_timeline_label returns ggplot object", {
  gt <- df2 + geom_timeline_label()
  testthat::expect_that(gt, is_a("ggplot"))
})
csgbloom/NOAAearthquake documentation built on April 12, 2021, 12:40 p.m.