diff --git a/R/utils.R b/R/utils.R index 5d37561a..3695c501 100644 --- a/R/utils.R +++ b/R/utils.R @@ -24,6 +24,7 @@ format_list <- function(values) { check_is_recent <- function(dates, max_age) { (!is.null(dates) && any(dates >= format(Sys.Date() - max_age, format = "%Y%m%d"))) } + #' helper that checks whether a call is actually cachable #' #' @keywords internal diff --git a/tests/testthat/test-cache.R b/tests/testthat/test-cache.R index c0e18031..8f13f04b 100644 --- a/tests/testthat/test-cache.R +++ b/tests/testthat/test-cache.R @@ -1,6 +1,7 @@ test_that("basic cache setup", { expect_true(is.null(cache_environ$epidatr_cache)) }) + tmp_base_dir <- Sys.getenv("TMPDIR") new_temp_dir <- NULL if (tmp_base_dir == "") { @@ -11,6 +12,7 @@ if (tmp_base_dir == "") { md5(paste(Sys.time(), "I am the very model of a modern major general")) ) } + test_set_cache <- function(cache_dir = new_temp_dir, days = 1, max_size = 1,