Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JsLth committed Sep 20, 2024
1 parent b553493 commit 6100221
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions R/guess.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ors_guess <- function(poly = NULL,
poly_fun = sf::st_convex_hull,
instance = NULL,
...) {
if (is.null(poly)) {
if (is.null(poly)) { # nocov start
poly <- sf::st_as_sfc(sf::st_bbox(c(
xmin = -180,
ymin = -90,
Expand Down Expand Up @@ -95,5 +95,5 @@ ors_guess <- function(poly = NULL,
}
)

poly_fun(sf::st_union(res), ...)
poly_fun(sf::st_union(res), ...) # nocov end
}
11 changes: 11 additions & 0 deletions tests/testthat/test-requests.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ with_mock_dir("directions", {
expect_gt(nrow(res1), nrow(res2))
expect_gt(nrow(res2), nrow(res3))
})

it("can format extra info", {
res <- ors_inspect(src[1:2], extra_info = TRUE)
expect_in(
c(
"type", "instruction", "exit_number", "steepness", "suitability",
"surface", "waycategory", "waytype"
),
names(res)
)
})
})
})

Expand Down
6 changes: 2 additions & 4 deletions tests/testthat/test-sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ test_that("extract is read and processed properly", {

test_that("fails properly", {
ors$rm_extract()
print(identify_extract(get_instance()$paths$top))
get_extract_boundaries()
expect_error(get_extract_boundaries(force = TRUE), class = "ors_extract_not_found_error")

ors <- ors_instance(server = "public")
print(ors_is_local(ors))
get_extract_boundaries()
expect_error(get_extract_boundaries(force = TRUE), class = "ors_remote_sample_error")
})


Expand Down

0 comments on commit 6100221

Please sign in to comment.