tests/testthat/test-echantillonage.R

# Tests de echantillonage()

test_that("echantillonage() format long snapshot", {
  res <- echantillonage(enquete = "EIR_2016", format = "long")
  expect_s3_class(res, "data.table")
  expect_named(res, c("enquete", "jour_de_naissance"))
  expect_snapshot_value(as.data.frame(res), style = "json2", cran = TRUE)
})

test_that("echantillonage() format large snapshot", {
  res <- echantillonage(enquete = c("EIR_2016", "EIC_2017"), format = "large")
  expect_snapshot_value(as.data.frame(res), style = "json2", cran = TRUE)
})

test_that("echantillonage() erreur sur enquête inconnue", {
  expect_error(echantillonage(enquete = "EIR_2099"), "inconnues")
})

Try the legiretraite package in your browser

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

legiretraite documentation built on Oct. 7, 2026, 5:09 p.m.