tests/testthat/test-docs.R

test_that("atom_db_details() documents both ATOM database functions", {
  details <- atom_db_details("address")

  expect_match(details, "[catr_atom_get_address_db_all()]", fixed = TRUE)
  expect_match(details, "[catr_atom_get_address_db_to()]", fixed = TRUE)
  expect_match(details, "Basque Country and Navarre", fixed = TRUE)
})

test_that("ovc_coordinate_details() documents optional INE fields", {
  without_ine <- ovc_coordinate_details()
  with_ine <- ovc_coordinate_details(include_ine = TRUE)

  expect_match(without_ine, "`geo.xcen`, `geo.ycen`, `geo.srs`", fixed = TRUE)
  expect_no_match(without_ine, "`cmun_ine`", fixed = TRUE)
  expect_match(with_ine, "`cmun_ine`", fixed = TRUE)
  expect_match(with_ine, "National Statistics Institute", fixed = TRUE)
  expect_match(with_ine, "Full five-digit INE municipality code", fixed = TRUE)
  expect_match(with_ine, "- `dis`: Distance", fixed = TRUE)
  expect_no_match(without_ine, "- `dis`", fixed = TRUE)
})

test_that("ovcurl() maps service identifiers to stable URLs", {
  base <- "https://ovc.catastro.meh.es/ovcservweb/ovcswlocalizacionrc"

  expect_identical(ovcurl("another"), base)
  expect_identical(
    ovcurl("CPMRC"),
    paste0(base, "/ovccoordenadas.asmx?op=Consulta_CPMRC")
  )
  expect_identical(
    ovcurl("mun"),
    paste0(
      base,
      "/ovccallejerocodigos.asmx?op=ConsultaMunicipioCodigos"
    )
  )
  expect_identical(
    ovcurl("prov"),
    paste0(base, "/ovccallejerocodigos.asmx?op=ConsultaProvincia")
  )
  expect_identical(
    ovcurl("RCCOORD"),
    paste0(base, "/ovccoordenadas.asmx?op=Consulta_RCCOOR_Distancia")
  )
  expect_identical(
    ovcurl("RCCOOR"),
    paste0(base, "/ovccoordenadas.asmx?op=Consulta_RCCOOR")
  )
})
test_that("wfs_map_seealso() produce urls", {
  expect_snapshot(wfs_map_seealso())
})
test_that("cache_directory_seealso () produce urls", {
  expect_snapshot(cache_directory_seealso())
})

Try the CatastRo package in your browser

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

CatastRo documentation built on Oct. 5, 2026, 5:07 p.m.