test_that(".get_chirps works", { skip_on_cran() aoi <- read_sf( system.file("extdata", "sierra_de_neiba_478140.gpkg", package = "mapme.biodiversity" ) ) aoi <- suppressWarnings(st_cast(aoi, to = "POLYGON")[1, ]) temp_loc <- file.path(tempdir(), "mapme.biodiversity") dir.create(temp_loc, showWarnings = FALSE) resource_dir <- system.file("res", package = "mapme.biodiversity") file.copy(resource_dir, temp_loc, recursive = TRUE) outdir <- file.path(tempdir(), "mapme.biodiversity", "res") tmpdir <- tempdir() portfolio <- init_portfolio(aoi, years = 2000:2020, outdir = outdir, tmpdir = tmpdir, verbose = FALSE ) # Add testing attribute in order to skip downloads attributes(portfolio)$testing <- TRUE urls <- .get_chirps(portfolio) exts <- unique(substr(urls, nchar(urls[1]) - 5, nchar(urls[1]))) expect_equal(exts, "tif.gz") })