tests/testthat/test-test_refresh_data_length.R

# a function to run a test for a single refresh function
# that checks it's length
check_len <- function(arow) {
  test_that(
    glue::glue("The number of rows from {arow$fun} is equal to
                 or greater than {arow$date_check}"),
    expect_gt(
      nrow(arow$dat[[1]]), #get the data),
      arow$len - 1
    ) # nrows on 2020-05-11
  )
}

# check the number of rows is greater than it was when the
# function was added to the package
for (i in seq_len(nrow(refresh_funs))) {
  check_len(refresh_funs[i, ])
}
Covid19R/covid19mobility documentation built on March 11, 2021, 12:46 p.m.