tests/testthat/test-validation.R

test_that("Date validation works", {
  skip_on_cran()
  skip_on_ci()

  expect_error(
    get_steps("foobar"),
    "Date validation failed"
  )

  expect_error(
    validate_date("foo"),
    "Date validation failed"
  )

  expect_true(validate_date("2021-02-01"))
  expect_true(validate_date("1/2/22"))
  expect_true(validate_date("1/2/2022"))
  expect_true(validate_date(lubridate::today()))
})

Try the fitbitr package in your browser

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

fitbitr documentation built on March 31, 2023, 9:10 p.m.