Skip to content

Commit

Permalink
Unit tests for monster_creator
Browse files Browse the repository at this point in the history
  • Loading branch information
njlyon0 committed May 3, 2024
1 parent b98cd5f commit 7beaff3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/testthat/test-monster_creator.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Run all tests in this script:
## testthat::test_file(file.path("tests", "testthat", "test-monster_creator.R"))

# Error testing
test_that("Errors work as desired", {
expect_error(monster_creator(party_level = NULL, party_size = NULL))
expect_error(monster_creator(party_level = 6, party_size = NULL))
expect_error(monster_creator(party_level = NULL, party_size = 4))
expect_error(monster_creator(party_level = "six", party_size = 4))
expect_error(monster_creator(party_level = 6, party_size = "four"))
})

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

# # Message testing
# test_that("Messages work as desired", {
# # No messages in this function
# })

# Output testing
test_that("Outputs are as expected", {
expect_equal(class(monster_creator(party_level = 4, party_size = 4)), "data.frame")
})

0 comments on commit 7beaff3

Please sign in to comment.