Skip to content

Commit

Permalink
Merge pull request #75 from getwilds/main
Browse files Browse the repository at this point in the history
merging main to dev
  • Loading branch information
realbp authored Mar 18, 2024
2 parents 91dd098 + e5df87e commit ee8903a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
14 changes: 14 additions & 0 deletions tests/testthat/test-incidence-cancer.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,20 @@ test_that("incidence_cancer has correct number of columns", {
expect_equal(ncol(df2), expected_columns2)
})

#test error handling
test_that("incidence_cancer handles invalid cancer parameters", {
expect_error(
incidence_cancer("wa", "county", "all cancer sites", "black (non-hispanic)",
"both sexes", "ages 65+", "late stage (regional & distant)"),
"For this cancer type, stage must be all stages"
)
expect_error(
incidence_cancer("ca", "hsa", "prostate", "all races (includes hispanic)", "both sexes",
"ages 50+", "all stages"),
"For prostate cancer, sex must be males."
)
})

# parameter
test_that("incidence_cancer has correct parameters", {
expect_error(incidence_cancer())
Expand Down
18 changes: 17 additions & 1 deletion tests/testthat/test-mortality-cancer.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,23 @@ test_that("mortality_cancer has correct number of columns", {
expect_equal(ncol(df), expected_columns)
})

# parameter
#test error handling
test_that("mortality_cancer handles invalid cancer parameters", {
expect_error(
mortality_cancer(area="wa", areatype="county", cancer="ovary",
race="all races (includes hispanic)",
sex="both sexes", age="ages 50+"),
"For this cancer type, sex must be females"
)
expect_error(
mortality_cancer("usa", "state", "prostate", "all races (includes hispanic)",
"both sexes", "ages 50+"),
"For prostate cancer, sex must be males."
)
})

#parameter
test_that("mortality_cancer has correct parameters", {
expect_error(mortality_cancer())
})

0 comments on commit ee8903a

Please sign in to comment.