Skip to content

Commit

Permalink
Update quiz checks because some are supposed to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy committed Jun 27, 2024
1 parent 30c9010 commit 8b97640
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 11 additions & 3 deletions tests/testthat/test-quizzes.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ test_that("Quiz checks", {
good_quiz_checks <- check_all_questions(good_quiz_specs)

# Using bad quiz md example

bad_quiz <- readLines(bad_quiz_path())
bad_quiz_specs <- parse_quiz(bad_quiz)
bad_quiz_checks <- check_all_questions(bad_quiz_specs)

# THe following checks *should fail* because we're giving it a bad quiz.
bad_quiz_checks <- try(check_all_questions(bad_quiz_specs), silent = TRUE)

## Make a temporary quiz directory
quiz_dir <- dirname(good_quiz_path())

## Now check the quizzes in that directory
all_quiz_results <- check_quizzes(quiz_dir = quiz_dir)
# The following checks *should also fail* because the bad quiz is in there
all_quiz_results <- try(check_quizzes(quiz_dir = quiz_dir), silent = TRUE)

## TEST HERE:
# 1. quiz_error_report.tsv should be made
# 2. bad quiz should have errors
# 3. good quiz should pass!

})
3 changes: 1 addition & 2 deletions tests/testthat/test-rmd_leanpub_prep.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ test_that("Create Leanpub IFrames for Rmd", {
ottrpal::bookdown_to_embed_leanpub(
render = FALSE,
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv',
make_book_txt = TRUE,
quiz_dir = "quizzes")
make_book_txt = TRUE)

## TEST HERE:
# 1. Did each chapter get a md in the manuscript folder?
Expand Down

0 comments on commit 8b97640

Please sign in to comment.