From ef5b5306f135b18e5ee72657b5031cd0aff49356 Mon Sep 17 00:00:00 2001 From: "Adam H. Sparks" Date: Sat, 30 Nov 2024 20:50:37 +0800 Subject: [PATCH] fixes tests --- tests/testthat/test-get_aagis_regions.R | 31 +++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/tests/testthat/test-get_aagis_regions.R b/tests/testthat/test-get_aagis_regions.R index b2a65a6..af168c8 100644 --- a/tests/testthat/test-get_aagis_regions.R +++ b/tests/testthat/test-get_aagis_regions.R @@ -3,25 +3,22 @@ withr::local_envvar(R_USER_CACHE_DIR = file.path(tempdir(), "abares.cache.1")) # without caching ---- -with_mock_dir("test-get_aagis_regions", { - test_that("get_aagis_regions doesn't cache", { - skip_if_offline() - skip_on_ci() - x <- get_aagis_regions(cache = FALSE) - expect_s3_class(x, "sf") - expect_false(file.exists( - file.path(.find_user_cache(), "aagis_regions_dir/aagis.rds") - )) - }) +test_that("get_aagis_regions doesn't cache", { + skip_if_offline() + skip_on_ci() + x <- get_aagis_regions(cache = FALSE) + expect_s3_class(x, "sf") + expect_false(file.exists( + file.path(.find_user_cache(), "aagis_regions_dir/aagis.rds") + )) }) -with_mock_dir("test-get_aagis_regions", { - test_that("get_aagis_regions skips downloading if still in tempdir()", { - skip_if_offline() - skip_on_ci() - x <- .check_existing_aagis(cache = FALSE) - expect_s3_class(x, "sf") - }) + +test_that("get_aagis_regions skips downloading if still in tempdir()", { + skip_if_offline() + skip_on_ci() + x <- .check_existing_aagis(cache = FALSE) + expect_s3_class(x, "sf") }) # with caching ----