Skip to content

Commit

Permalink
fix: ensure optional requirements in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo committed Aug 14, 2024
1 parent e2275ab commit 4590f44
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/testthat/setup-logger.R
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
logger::log_appender(function(...) NULL, namespace = "teal.modules.general")
if (requireNamespace("logger", quietly = TRUE)) {
logger::log_appender(function(...) NULL, namespace = "teal.modules.general")
}
1 change: 1 addition & 0 deletions tests/testthat/test-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ for (i in rd_files()) {
paste0("example-", basename(i)),
{
skip_if_too_deep(5)
testthat::skip_if_not_installed("pkgload")
if (basename(i) %in% strict_exceptions) {
op <- options()
withr::local_options(opts_partial_match_old)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-shinytest2-tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test_that("e2e - tm_data_table: Verify checkbox displayed over data table", {
})

test_that("e2e - tm_data_table: Verify module displays data table", {
testthat::skip_if_not_installed("rvest")
skip_if_too_deep(5)
app_driver <- app_driver_tm_data_table()

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-shinytest2-tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ app_driver_tm_file_viewer <- function() {
}

test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree specified in input_path argument", {
testthat::skip_if_not_installed("rvest")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()

Expand All @@ -42,6 +43,7 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree
})

test_that("e2e - tm_file_viewer: Shows selected image file", {
testthat::skip_if_not_installed("rvest")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()

Expand All @@ -58,6 +60,7 @@ test_that("e2e - tm_file_viewer: Shows selected image file", {
})

test_that("e2e - tm_file_viewer: Shows selected text file", {
testthat::skip_if_not_installed("rvest")
skip_if_too_deep(5)
app_driver <- app_driver_tm_file_viewer()

Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-shinytest2-tm_misssing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ test_that("e2e - tm_missing_data: Validate functionality and UI response for 'By
})

test_that("e2e - tm_missing_data: Validate 'By Variable Levels' table values", {
testthat::skip_if_not_installed("rvest")
skip_if_too_deep(5)
app_driver <- app_driver_tm_missing_data()

Expand Down

0 comments on commit 4590f44

Please sign in to comment.