tests/testthat/test-reversegeo.R

test_that("Check good response", {
  country <- "Spain"
  city <- "Madrid"
  postcode <- "28012"
  state <- "Community of Madrid"

  response <- reversegeo(40.414915938483574, -3.706841931806074)

  expect_identical(response$country, country)
  expect_identical(response$city, city)
  expect_identical(response$postcode, postcode)
  expect_identical(response$state, state)
})

test_that("Check error response", {
  error <- "error"
  response <- reversegeo(40.414915938483574, -Inf)

  expect_equal(response$error, error)
})
alceal/reversegeo documentation built on Dec. 19, 2021, 12:25 a.m.