tests/testthat/test-race_mod.R

# Run all tests in this script:
## testthat::test_file(file.path("tests", "testthat", "test-race_mod.R"))

# Error testing
test_that("Errors work as desired", {
  ## Unspecified PC race
  expect_error(dndR::race_mods(race = NULL))
  ## Unsupported PC race
  expect_error(dndR::race_mods(race = "fake pc race"))
})

# # Warning testing
# test_that("Warnings work as desired", {
#   # No warnings in function
# })

# Message testing
test_that("Messages work as desired", {
  expect_message(dndR::race_mods(race = "random"))
  expect_message(dndR::race_mods(race = "plasmoid"))
})

# Output testing
test_that("Outputs are as expected", {
  expect_equal(class(dndR::race_mods(race = "stout halfling")), "data.frame")
})

Try the dndR package in your browser

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

dndR documentation built on June 11, 2025, 5:09 p.m.