tests/testthat/test_ip_info.R

context("Test ipinfo")

test_that("data.frames can be returned from ip-info", {
  skip_on_cran()
  result <-  ip_info("2607:FB90:426:DC1D:CFC4:4875:8BC2:4D93")
  expect_that(is.data.frame(result), equals(TRUE))
  expect_that(nrow(result), equals(1))
})

test_that("data.frames with false entries can be returned from ip-info", {
  skip_on_cran()
  result <- ip_info(c("2607:FB90:426:DC1D:CFC4:4875:8BC2:4D93",
                      "foo"))
  expect_that(is.data.frame(result), equals(TRUE))
  expect_that(nrow(result), equals(2))
  expect_true(any(is.na(result)))
})

Try the rgeolocate package in your browser

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

rgeolocate documentation built on Oct. 21, 2021, 1:06 a.m.