tests/testthat/test-fetch_mayoral.R

test_that("Gives a data frame", {
  expect_true(is.data.frame(fetch_mayoral()))
})

test_that("Has no duplicate rows", {
  expect_true(!anyDuplicated(fetch_mayoral()))
})

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Snapshot test outputs
test_that("locations per year are consistent", {
  expect_snapshot(
    lapply(2017:2025, fetch_mayoral)
  )
})

Try the dfeR package in your browser

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

dfeR documentation built on Sept. 24, 2026, 1:07 a.m.