Skip to content

Commit

Permalink
fix: test if builtin provider actually exists
Browse files Browse the repository at this point in the history
  • Loading branch information
rCarto committed Jan 11, 2024
1 parent 01098eb commit aa77d3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ get_param <- function(provider) {
"Stamen.Watercolor", "Stamen.Terrain", "Stamen.TerrainBackground",
"Stamen.TerrainLabels"
)
builtin_provider <- c(stamen_provider, names(.global_maptiles$providers))
if (!provider %in% builtin_provider){
stop(paste0("'",provider,"' is not a builtin provider."), call. = FALSE)
}
if (provider %in% stamen_provider) {
provider <- paste0("Stadia.", provider)
warning(
Expand Down
2 changes: 1 addition & 1 deletion inst/tinytest/test_maptiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ stadia <- list(src = "Stadia.Stamen.Toner",
ext = "png")
expect_identical(maptiles:::get_param("OpenStreetMap"), osm)
expect_warning(maptiles:::get_param("Stamen.Toner"))

expect_error(maptiles:::get_param("Esri.Delorme"))

# get_zoom() ----
expect_equal(maptiles:::get_zoom(bbox_lonlat = nc_bbox), 7)
Expand Down

0 comments on commit aa77d3e

Please sign in to comment.