tests/testthat/test-nyc_permit_events_historic.R

test_that("nyc_permit_events_historic returns a tibble and respects limits", {
  # This 'cassette' will be saved in tests/fixtures/nyc_311_test.yml
  vcr::use_cassette("nyc_permit_events_historic_test", {

    # We use a small limit (2) to keep the recording file small
    results <- nyc_permit_events_historic(limit = 2)

    # Assertions: What should be true?
    expect_s3_class(results, "tbl_df")
    expect_equal(nrow(results), 2)
  })
})

test_that("nyc_permit_events_historic throws errors for bad inputs", {
  # This touches the new 'stop' lines you just added
  expect_error(nyc_permit_events_historic(limit = "a string"))
  expect_error(nyc_permit_events_historic(filters = "not a list"))
})

Try the nycOpenData package in your browser

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

nycOpenData documentation built on Feb. 15, 2026, 1:07 a.m.