tests/testthat/test_timeline.R

context('geom_timeline')

test_that('geom_timeline TRUE', {
  dat <-NOAA_quakes
  
  plot1 <- NOAA_quakes%>%eq_clean_data()%>%
      dplyr::filter(COUNTRY %in% c('MEXICO')) %>%
      dplyr::filter(DATE > '2010-01-01') %>%
      ggplot2::ggplot() +
      geom_timeline(aes(x = DATE, y = COUNTRY, size = as.numeric(EQ_PRIMARY),
                        color = as.numeric(TOTAL_DEATHS)))
  
  expect_s3_class(plot1, 'ggplot')
  expect_length(plot1$layers, 1)
  
  plot2 <-  NOAA_quakes%>%eq_clean_data()%>%
    dplyr::filter(COUNTRY %in% c('MEXICO','USA')) %>%
    dplyr::filter(DATE > '2010-01-01') %>%
    ggplot2::ggplot() +
    geom_timeline(aes(x = DATE, y = COUNTRY, size = as.numeric(EQ_PRIMARY),
                      color = as.numeric(TOTAL_DEATHS)))
  expect_length(plot2$labels, 4)
 

  
})
jyjek/jyjekNOAA documentation built on May 7, 2019, 10:52 p.m.