tests/testthat/test-bulk_reverse_geocoding.R

context("bulk_reverse_geocoding")

test_that("bulk_reverse_geocoding works as expected", {
  # Don't run these tests on the CRAN build servers
  skip_on_cran()

  single_coordinate <- 3.15807
  geolocations_list <- structure(
    list(
      geolocations = structure(
        list(
          longitude = c(-3.15807731271522, -1.12935802905177),
          latitude = c(51.4799900627036, 50.7186356978817),
          limit = c(NA, 100L),
          radius = c(NA, 500L)),
        .Names = c("longitude", "latitude", "limit", "radius"),
        class = "data.frame",
        row.names = 1:2)),
    .Names = "geolocations")

  geocoding_results <- bulk_reverse_geocoding(geolocations_list)

  expect_error(bulk_reverse_geocoding(single_coordinate))
  expect_that(geocoding_results, is_a("list"))
})

Try the PostcodesioR package in your browser

Any scripts or data that you put into this service are public.

PostcodesioR documentation built on March 18, 2022, 8:04 p.m.