tests/testthat/test-api_rate_limit_helpers.R

test_that("API rate limit warning is displayed correctly", {
  # Capture the output
  expect_snapshot(check_unique_pat(n_patients = 60, use_api = TRUE))

  # Test that nothing is output when no warning needed
  expect_snapshot(check_unique_pat(n_patients = 40, use_api = TRUE))

  expect_snapshot(check_unique_pat(n_patients = 60, use_api = FALSE))
})

test_that("API usage advisory is displayed correctly for <50 patients", {
  # Capture the output for fewer than 50 patients
  expect_snapshot(advise_api_usage(n_patients = 30, use_api = TRUE))

  # Test that nothing is output when API is not used
  expect_snapshot(advise_api_usage(n_patients = 30, use_api = FALSE))
})

Try the mmequiv package in your browser

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

mmequiv documentation built on June 8, 2025, 11:12 a.m.