-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit Testing for make_screenshots and some other things 😬 #158
base: main
Are you sure you want to change the base?
Conversation
Admittedly this PR got a bit out of control because I was doing some stream of conscientiousness software development (whoops) so there's also some reorganization as well as some cleaning out of unnecessary functions. |
#' | ||
#' @param dir What relative file path should the files be downloaded | ||
#' @param type Which OTTR repo are we downloading? Options are "rmd", "quarto", "rmd_website", "quarto_website" | ||
#' | ||
#' @return This downloads the main branch repo files from the respective repo for testing purposes | ||
#' @export | ||
download_ottr_template <- function(dir = "inst/extdata", type = "rmd") { | ||
setup_ottr_template <- function(dir = "inst/extdata", type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for test purposes, it can be run before we need to do anything with an OTTR repo and it will do the rendering step too.
#' | ||
#' @return Looks for dangling zips and directories downloaded for testing and removes them | ||
#' @export | ||
clean_up <- function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be run after tests so that the files are cleaned up.
@@ -0,0 +1,290 @@ | |||
#' Retrieve pages url for a repo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now this is a direct copy over from cow. But I'll be doing some reworking of this #157
@@ -0,0 +1,229 @@ | |||
#' Get Slide ID from URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not new code I just put all the stuff pertaining to google slides in one spot.
R/leanpub.R
Outdated
#' repo = "jhudsl/OTTR_Template") | ||
#' | ||
#' } | ||
make_screenshots <- function(git_pat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved make screenshots here since it mostly pertains to this anyway.
@@ -2,6 +2,201 @@ | |||
|
|||
utils::globalVariables(c("question", "original", "n", "metadata_check", "index", "ignore_coursera")) | |||
|
|||
|
|||
find_end_of_prompt <- function(start_prompt_index, type_vector) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All quiz stuff is now in one place.
.github/workflows/R-CMD-check.yaml
Outdated
runs-on: ubuntu-latest | ||
container: | ||
image: jhudsl/base_ottr | ||
runs-on: ${{ matrix.config.os }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These edits are a direct bring over from gimap because this needed some updates
check_result <- grep("Status\\:", check_content, value = TRUE) | ||
check_result <- unlist(strsplit(check_result, ",")) | ||
check_result <- stringr::str_remove(check_result, "Status:| ") | ||
check_content <- readLines(out_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also brought over from gimap
@@ -1,54 +1,43 @@ | |||
## These tests make sure the infrastructure for setting up test OTTR repos is working |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually where we get to the unit tests.
Tests are failing mostly because the github pat stuff needs to be refactored and I will do that in a new PR so this one doesn't just continue to grow. |
@kweav Most of this is a re-org + Unit tests. Ideally I should have split this out a bit but I think after this PR things should be a bit more smaller chunks and manageable. Mostly just focus on review of the tests. |
Purpose/implementation Section
What changes are being implemented in this Pull Request?
A follow up on #145 -- adding the needed unit tests here!
What was your approach?
@kweav and I pair programmed a bit and ran into a few bugs but otherwise I started splitting out the tests and putting the new make_screenshots function in here.
What GitHub issue does your pull request address?
#145
Tell potential reviewers what kind of feedback you are soliciting.