tests/testthat/test_last_update.R

context("test cs_last_update function")

# test inputs ------------------------------------------------

test_that("misspecified functions return errors", {
  expect_error(cs_last_update(output = "ham"),
               "The only accepted arguments for 'cs_last_update' are 'string' and 'date'.")
})

# test results ------------------------------------------------

result1 <- cs_last_update(output = "string")
result2 <- cs_last_update(output = "date")

test_that("correctly specified functions execute without error", {
  skip_on_cran()
  skip_if_offline(host = "r-project.org")
  expect_equal(class(result1), "character")
  expect_equal(class(result2), "Date")
})

Try the compstatr package in your browser

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

compstatr documentation built on July 8, 2020, 7:34 p.m.