tests/testthat/test-timeline.R

test_that("correct message is fed back", {
  expect_output(
    timeline(
      forestprecipitation$january,
      datetime_variable = "time",
      expected_lag = 1
    ),
    "There are no time lags which are greater than the expected lag"
  )
  expect_output(
    timeline(
      forestprecipitation$february,
      datetime_variable = "time",
      expected_lag = 1
    ),
    "There are time lags which are greater than the expected lag"
  )
})

test_that("correct message is fed back", {
  expect_true(
    timeline(
      forestprecipitation$january,
      datetime_variable = "time",
      expected_lag = 1
    )
  )
  expect_false(
    timeline(
      forestprecipitation$february,
      datetime_variable = "time",
      expected_lag = 1
    )
  )
})

Try the butterfly package in your browser

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

butterfly documentation built on April 12, 2025, 9:10 a.m.