Skip to content

Commit

Permalink
Add test for new check
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed May 23, 2024
1 parent 15c8677 commit f10b7a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/build-articles.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
Error in `data_articles_index_()`:
! articles[1] must be a list, not the number 1.
i Edit _pkgdown.yml to fix the problem.
Code
data_articles_index_(list(list()))
Condition
Error in `data_articles_index_()`:
! articles[1] must have components "title" and "contents".
2 missing components: "title" and "contents".
i Edit _pkgdown.yml to fix the problem.
Code
data_articles_index_(list(list(title = 1, contents = 1)))
Condition
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-build-articles.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ test_that("validates articles yaml", {
expect_snapshot(error = TRUE, {
data_articles_index_(1)
data_articles_index_(list(1))
data_articles_index_(list(list()))
data_articles_index_(list(list(title = 1, contents = 1)))
data_articles_index_(list(list(title = "a\n\nb", contents = 1)))
data_articles_index_(list(list(title = "a", contents = 1)))
Expand Down

0 comments on commit f10b7a7

Please sign in to comment.