tests/testthat/test-nyc_city_record.R

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

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

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

Try the nycOpenData package in your browser

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

nycOpenData documentation built on Jan. 26, 2026, 1:06 a.m.