tests/testthat/test-plot_annual_cumulative_stats.R

context("Plot annual cumulative stats")

test_that("a list of plots is created", {
  skip_on_cran()
  skip_on_ci()
  plots <- plot_annual_cumulative_stats(station_number = "08NM116", start_year = 1980)
  expect_true("list" %in% class(plots) & "gg" %in% sapply(plots, class))
})

test_that("multiple plots are created with multiple groups", {
  skip_on_cran()
  skip_on_ci()
  plots <- plot_annual_cumulative_stats(station_number = c("08NM116","08HB048"), start_year = 1980)
  expect_true(length(plots) == 2)
})

test_that("multiple plots are created with include_seasons", {
  skip_on_cran()
  skip_on_ci()
  plots <- plot_annual_cumulative_stats(station_number = c("08NM116"), 
                                        start_year = 1980, 
                                        include_seasons = TRUE)
  expect_true(length(plots) == 3)
})

test_that("multiple plots are created with multiple groups and include_seasons", {
  skip_on_cran()
  skip_on_ci()
  plots <- plot_annual_cumulative_stats(station_number = c("08NM116", "08HB048"), 
                                        start_year = 1980, 
                                        include_seasons = TRUE)
  expect_true(length(plots) == 6)
})
bcgov/fasstr documentation built on Oct. 1, 2024, 4:14 p.m.