-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'cansavvy/test-framework' into cansavvy/reorg
- Loading branch information
Showing
8 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(ottrpal) | ||
|
||
test_check("ottrpal") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
test_that("Tocless render for Quarto", { | ||
|
||
dir <- download_ottr_template(dir = "inst/extdata", type = "quarto") | ||
|
||
# render_without_toc() | ||
|
||
# TODO: This should be functionalized and incorporated into the package | ||
# curl -o make_screenshots.R https://raw.githubusercontent.com/jhudsl/ottr-reports/main/scripts/make_screenshots.R | ||
# chapt_urls=$(Rscript --vanilla make_screenshots.R \ | ||
# --git_pat ${{ secrets.GH_PAT }} \ | ||
# --repo $GITHUB_REPOSITORY \ | ||
# --output_dir resources/chapt_screen_images) | ||
unlink(dir, recursive = TRUE) | ||
}) | ||
|
||
|
||
test_that("Create Leanpub IFrames for Quarto", { | ||
# ottrpal::bookdown_to_embed_leanpub( | ||
# render = FALSE, \ | ||
# chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ | ||
# make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}'), \ | ||
# quiz_dir = NULL) | ||
|
||
# ottrpal::bookdown_to_embed_leanpub( | ||
# render = FALSE, \ | ||
# chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ | ||
# make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}')) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
test_that("Quiz checks", { | ||
# Using good quiz md example | ||
|
||
quiz_path <- good_quiz_path() | ||
good_quiz <- readLines(quiz_path) | ||
good_quiz_specs <- parse_quiz(good_quiz) | ||
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) | ||
|
||
## 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) | ||
|
||
# Need to download OTTR course for testing | ||
# ottrpal::check_quizzes(quiz_dir = file.path(root_dir, "quizzes"), write_report = TRUE, verbose = TRUE) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
test_that("Rmd Rendering", { | ||
dir <- download_ottr_template(dir = ".", type = "rmd") | ||
|
||
bookdown::render_book("OTTR_Template-main") | ||
unlink(dir) | ||
}) | ||
|
||
test_that("Quarto Rendering", { | ||
dir <- download_ottr_template(dir = ".", type = "quarto") | ||
|
||
quarto::quarto_render(dir) | ||
quarto::quarto_render(dir, | ||
metadata = list(sidebar = F, toc = F), | ||
quarto_args = c("--output-dir", "docs/no_toc/") | ||
) | ||
unlink(dir) | ||
}) | ||
|
||
test_that("Rmd Website Rendering", { | ||
dir <- download_ottr_template(dir = ".", type = "rmd_website") | ||
|
||
rmarkdown::clean_site(dir, preview = FALSE) | ||
|
||
rmarkdown::render_site(dir) | ||
|
||
unlink(dir) | ||
}) | ||
|
||
|
||
test_that("Quarto Website Rendering", { | ||
dir <- download_ottr_template(dir = ".", type = "quarto_website") | ||
|
||
quarto::quarto_render(dir) | ||
|
||
unlink(dir) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
test_that("Tocless render for Rmd", { | ||
# render_without_toc() | ||
dir <- download_ottr_template(dir = ".", type = "rmd") | ||
|
||
# TODO: This should be functionalized and incorporated into the package | ||
# curl -o make_screenshots.R https://raw.githubusercontent.com/jhudsl/ottr-reports/main/scripts/make_screenshots.R | ||
# chapt_urls=$(Rscript --vanilla make_screenshots.R \ | ||
# --git_pat ${{ secrets.GH_PAT }} \ | ||
# --repo $GITHUB_REPOSITORY \ | ||
# --output_dir resources/chapt_screen_images) | ||
|
||
unlink("dir", recursive = TRUE) | ||
}) | ||
|
||
|
||
test_that("Create Leanpub IFrames for Rmd", { | ||
|
||
dir <- download_ottr_template(dir = ".", type = "rmd") | ||
|
||
# ottrpal::bookdown_to_embed_leanpub( | ||
# render = FALSE, \ | ||
# chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ | ||
# make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}'), \ | ||
# quiz_dir = NULL) | ||
|
||
# ottrpal::bookdown_to_embed_leanpub( | ||
# render = FALSE, \ | ||
# chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ | ||
# make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}')) | ||
|
||
unlink(dir, recursive = TRUE) | ||
}) |