tests/testthat/test-tm_t_smq.R

testthat::test_that("template_smq generates correct expressions with default arguments", {
  result <- template_smq(
    parentname = "adsl",
    dataname = "adae",
    arm_var = c("ARMCD", "SEX"),
    id_var = "USUBJID",
    llt = "AEDECOD",
    add_total = FALSE,
    drop_arm_levels = FALSE,
    na_level = "<Missing>",
    smq_varlabel = "Standardized MedDRA Query",
    baskets = c("SMQ01NAM", "SMQ02NAM", "CQ01NAM"),
    sort_criteria = c("freq_desc")
  )

  res <- testthat::expect_silent(result)
  testthat::expect_snapshot(res)
})

testthat::test_that("template_smq generates correct expressions with custom arguments", {
  result <- template_smq(
    parentname = "myadsl",
    dataname = "myadae",
    arm_var = "myARMCD",
    id_var = "myUSUBJID",
    llt = "myAEDECOD",
    add_total = FALSE,
    drop_arm_levels = FALSE,
    na_level = "<Missing>",
    smq_varlabel = "mylabel",
    baskets = c("mybaskets"),
    sort_criteria = c("freq_desc")
  )

  res <- testthat::expect_silent(result)
  testthat::expect_snapshot(res)
})

Try the teal.modules.clinical package in your browser

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

teal.modules.clinical documentation built on April 4, 2025, 12:35 a.m.