tests/testthat/test-utilities.R

test_that("addCdmName and addCohortName work", {
  skip_on_cran()
  cdm <- mockPatientProfiles()
  person <- cdm$person |> addCdmName()
  expect_equal(c("cdm_name", colnames(cdm$person)) |> sort(), colnames(person) |> sort())

  expect_message(cohort <- cdm$cohort1 |> addCdmName() |> addCdmName())
  expect_equal(c("cdm_name", colnames(cdm$cohort1)) |> sort(), colnames(cohort) |> sort())

  expect_error(person <- cdm$person |> addCohortName())

  expect_message(cohort <- cdm$cohort2 |> addCohortName() |> addCohortName())
  expect_equal(c("cohort_name", colnames(cdm$cohort2)) |> sort(), colnames(cohort) |> sort())
})

Try the PatientProfiles package in your browser

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

PatientProfiles documentation built on Oct. 30, 2024, 9:13 a.m.