tests/testthat/test_realtime_plot.R

test_that("realtime_plot will plot a lake only station", {
  skip_if_net_down()
  skip_on_cran()
  expect_message(realtime_plot("08NM083"))
})

test_that("realtime_plot will be silent is Parameter is set to Level", {
  skip_if_net_down()
  skip_on_cran()
  expect_silent(realtime_plot("08NM083", Parameter = "Level"))
})

test_that("realtime_plot will be silent when a river station is called", {
  skip_if_net_down()
  skip_on_cran()
  expect_silent(realtime_plot("08MF005", Parameter = "Level"))
})

test_that("realtime_plot will throw an error when try to plot more than one station", {
  skip_if_net_down()
  skip_on_cran()
  expect_error(realtime_plot(c("08NM083", "08MF005")))
})

test_that("throw an error when plotting a lake level station with Flow specified", {
  l <- realtime_dd("08KH011")
  expect_error(plot(l, Parameter = "Flow"))
  expect_silent(plot(l, Parameter = "Level"))
})

Try the tidyhydat package in your browser

Any scripts or data that you put into this service are public.

tidyhydat documentation built on April 4, 2023, 5:17 p.m.