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
.test_file <- function(file = NULL, use_parallel = FALSE) { | |
if (use_parallel) { | |
testthat::with_mocked_bindings( | |
devtools::test(filter = file), | |
find_parallel = function(...) { | |
TRUE | |
}, | |
.package = "testthat" | |
) | |
} |
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
#' Run callback when all inputs are initialized | |
#' | |
#' @param ids A character vector of input ids to check. | |
#' @param callback A function to run after all inputs are initialized. | |
#' @param session A Shiny session | |
#' @importFrom shiny reactiveVal observe getDefaultReactiveDomain | |
#' @importFrom purrr map reduce | |
#' @importFrom checkmate test_null | |
on_inputs_initialized <- function(ids, callback, session = getDefaultReactiveDomain()) { | |
initialized_ <- reactiveVal(FALSE) |
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
#' Download the latest snapshot artifacts from the CI and update local snapshots | |
#' | |
#' @details | |
#' | |
#' This function uses Github API to download the latest snapshot artifacts from the CI and update the local snapshots. | |
#' | |
#' In order for the API to work it needs to be authenticated. | |
#' | |
#' Run the following command in the terminal to authenticate the API: | |
#' ``` |
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
is_ci <- function() { | |
isTRUE(as.logical(Sys.getenv("CI"))) | |
} | |
make_variant <- function( | |
platform = shinytest2::platform_variant(), | |
data_version = getOption("test_data_version", "simulated")) { | |
ci <- if (is_ci()) { | |
"ci" | |
} else { |
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
#' Report all assertions | |
#' | |
#' @examples | |
#' with_assertion_collection( | |
#' assert_data_frame(df), | |
#' assert_numeric(nums), | |
#' assert_character(chars) | |
#' ) | |
with_assert_collection <- function(...) { | |
add <- makeAssertCollection() |