Skip to content

Commit

Permalink
Fix spell_check_notebooks() test
Browse files Browse the repository at this point in the history
  • Loading branch information
jabenninghoff committed Apr 25, 2022
1 parent 105329a commit 9f816c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion inst/templates/test-spelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ test_that("Notebooks have no spelling errors", {
skip_on_covr()
withr::local_dir(pkg_dir)
if (fs::dir_exists("analysis")) {
expect_identical(rdev::spell_check_notebooks()$word, character(0))
# spell_check_notebooks()$word is NULL if there are no notebooks or only empty notebooks
results <- rdev::spell_check_notebooks()
expect_true(is.null(results$word) || identical(results$word, character(0)))
} else {
expect_error(rdev::spell_check_notebooks(), "'analysis' directory not found")
}
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-spelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ test_that("Notebooks have no spelling errors", {
skip_on_covr()
withr::local_dir(pkg_dir)
if (fs::dir_exists("analysis")) {
expect_identical(rdev::spell_check_notebooks()$word, character(0))
# spell_check_notebooks()$word is NULL if there are no notebooks or only empty notebooks
results <- rdev::spell_check_notebooks()
expect_true(is.null(results$word) || identical(results$word, character(0)))
} else {
expect_error(rdev::spell_check_notebooks(), "'analysis' directory not found")
}
Expand Down

0 comments on commit 9f816c3

Please sign in to comment.