Error in `resolve_zenodo_version(metadata_doi, version, sandbox = FALSE)`: Failed to retrieve versions from Zenodo for DOI 10.5281/zenodo.17182171 after 3 attempts

test_that("get_cache_path constructs paths and creates directories", {
get_metadata_dir = function() fs::path(temp_dir, "metadata"),
get_data_dir = function() fs::path(temp_dir, "data"),
meta_path <- get_cache_path("0001", "v1", "meta.json", type = "metadata")
expected_meta_path <- fs::path(temp_dir, "metadata", "0001", "v1", "meta.json")
data_path <- get_cache_path("0002", "v2", "data.tsv", type = "data")
expected_data_path <- fs::path(temp_dir, "data", "0002", "v2", "data.tsv")
test_that("get_cache_dir returns correct paths", {
meta_path <- get_cache_dir(type = "metadata")
data_path <- get_cache_dir(type = "data")
test_that("cache_info works when cache exists", {
# Mock get_cache_dir to point to a controlled temporary directory
# Create a dummy file to give the cache some size
# Capture the output and check for expected messages
test_that("cache_info works when cache does not exist", {
# Capture the output and check for the specific message
expect_true(any(grepl("Cache directory does not exist yet", output)))
test_that("clear_cache works non-interactively with force = TRUE", {
# Capture output and check for success message
output <- cli::cli_fmt(clear_cache(force = TRUE))
test_that("clear_cache handles non-existent directory gracefully", {
# Capture output and check for the correct informational message
expect_true(any(grepl("Cache directory does not exist", output)))
test_that("read_json_safe handles errors correctly", {
# test with a non-existent file, which should trigger an error
# write invalid json (single quotes instead of double)
test_that("get_cache_dir returns correct path without type parameter", {
# directory should exist after calling the function
test_that("get_cache_dir returns correct path with type parameter", {
cache_dir <- get_cache_dir(type = "datasets")
# should contain both "openesm" and "datasets" in the path
cache_dir_meta <- get_cache_dir(type = "metadata")
test_that("get_cache_dir creates nested directories correctly", {
cache_dir <- get_cache_dir(type = "deep/nested/path")
test_that("download_metadata_from_zenodo handles errors gracefully", {
# test with invalid version that doesn't exist
# this should fail for a version that doesn't exist
download_metadata_from_zenodo(version = "999.999.999", dest_dir = temp_dir),
test_that("download_metadata_from_zenodo error handling works", {
# Test that the function exists and has proper structure
# Test error handling with mocked functions
resolve_zenodo_version = function(doi, version, sandbox) {
# trigger the resolve_zenodo_version error
download_metadata_from_zenodo(version = "invalid_version", dest_dir = temp_dir),