tests/testthat/test-surveys.r

test_that("get_citation() gives deprecation warning", {
  lifecycle::expect_deprecated(
    get_citation(polymod)
  )
})

test_that("surveys can be cited", {
  withr::local_options(lifecycle_verbosity = "quiet")
  expect_s3_class(get_citation(polymod), "bibentry")
})

test_that("missing surveys can't be cited", {
  withr::local_options(lifecycle_verbosity = "quiet")
  expect_error(get_citation("bogus"), "URL")
})

test_that("multiple DOIs cannot be loaded", {
  withr::local_options(lifecycle_verbosity = "quiet")
  expect_error(get_survey(c(
    "10.5281/zenodo.1095664", # nolint
    "10.5281/zenodo.1127693" # nolint
  )))
})

Try the socialmixr package in your browser

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

socialmixr documentation built on April 29, 2026, 9:07 a.m.