Skip to content

Commit

Permalink
fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks committed Nov 30, 2024
1 parent 0ec3e24 commit ef5b530
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions tests/testthat/test-get_aagis_regions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----
Expand Down

0 comments on commit ef5b530

Please sign in to comment.