Skip to content

Commit

Permalink
add tests for icd_10_get functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestguevarra committed Apr 23, 2024
1 parent 2dc31d9 commit f682563
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/icd_10_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ icd_10_get_release_by_category <- function(category,
#' @export
#'

icd_10_get_info <- function(release = NULL,
category,
icd_10_get_info <- function(category,
release = NULL,
api_version = c("v2", "v1"),
language = "en",
verbose = TRUE,
Expand Down
2 changes: 1 addition & 1 deletion man/icd_10_get.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions tests/testthat/test-icd_10_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,33 @@ testthat::test_that(
expect_warning(icd_10_get_chapters(language = "fr"))
}
)


release_category <- icd_10_get_release_by_category("A00")

testthat::test_that(
"release_category is of the right type", {
expect_type(release_category, "list")
}
)


release_info <- icd_10_get_info(category = "A00")

testthat::test_that(
"release_info is of the right type", {
expect_type(release_info, "list")
}
)

testthat::test_that(
"warning is raised for unavailable language", {
expect_warning(icd_10_get_info(category = "A00", language = "zz"))
}
)

testthat::test_that(
"error is raised for unavailable release", {
expect_error(icd_10_get_info(category = "A00", release = 2020))
}
)

0 comments on commit f682563

Please sign in to comment.