tests/testthat/test-summary.classcodes.R

x <- summary(elixhauser, "icd10cm")

test_that("summary.classcodes", {

  expect_is(x, "summary.classcodes")
  expect_equal(x$object, elixhauser)
  expect_equal(x$coding, "icd10cm")
  expect_message(
    summary(elixhauser, "icd10cm"),
    "Classification based on: icd10"
  )

  expect_error(summary(elixhauser, coding = "hej"), "'coding' should be one of")
  expect_equal(
    x$summary,
    summary(elixhauser, coding = decoder::icd10cm$key)$summary
  )
})


test_that("print.summary.classcodes", {
  expect_output(
    print(x),
    "Summary of classcodes object",
    fixed = TRUE
  )
})

Try the coder package in your browser

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

coder documentation built on March 31, 2023, 10:21 p.m.