diff --git a/tests/testthat/test-module_teal.R b/tests/testthat/test-module_teal.R index 3a1a143329..8a4f902c71 100644 --- a/tests/testthat/test-module_teal.R +++ b/tests/testthat/test-module_teal.R @@ -66,60 +66,59 @@ transform_list <<- list( ) decorators <- - -testthat::describe("srv_teal lockfile", { - testthat::it(paste0( - "creation process is invoked for teal.lockfile.mode = \"enabled\" ", - "and snapshot is copied to teal_app.lock and removed after session ended" - ), { - testthat::skip_if_not_installed("mirai") - testthat::skip_if_not_installed("renv") - withr::with_options( - list(teal.lockfile.mode = "enabled"), - { - renv_filename <- "teal_app.lock" - shiny::testServer( - app = srv_teal, - args = list( - id = "test", - data = teal.data::teal_data(iris = iris), - modules = modules(example_module()) - ), - expr = { - iter <- 1 - while (!file.exists(renv_filename) && iter <= 1000) { - Sys.sleep(0.5) - iter <- iter + 1 # max wait time is 500 seconds + testthat::describe("srv_teal lockfile", { + testthat::it(paste0( + "creation process is invoked for teal.lockfile.mode = \"enabled\" ", + "and snapshot is copied to teal_app.lock and removed after session ended" + ), { + testthat::skip_if_not_installed("mirai") + testthat::skip_if_not_installed("renv") + withr::with_options( + list(teal.lockfile.mode = "enabled"), + { + renv_filename <- "teal_app.lock" + shiny::testServer( + app = srv_teal, + args = list( + id = "test", + data = teal.data::teal_data(iris = iris), + modules = modules(example_module()) + ), + expr = { + iter <- 1 + while (!file.exists(renv_filename) && iter <= 1000) { + Sys.sleep(0.5) + iter <- iter + 1 # max wait time is 500 seconds + } + testthat::expect_true(file.exists(renv_filename)) } - testthat::expect_true(file.exists(renv_filename)) - } - ) - testthat::expect_false(file.exists(renv_filename)) - } - ) - }) - testthat::it("creation process is not invoked for teal.lockfile.mode = \"disabled\"", { - testthat::skip_if_not_installed("mirai") - testthat::skip_if_not_installed("renv") - withr::with_options( - list(teal.lockfile.mode = "disabled"), - { - renv_filename <- "teal_app.lock" - shiny::testServer( - app = srv_teal, - args = list( - id = "test", - data = teal.data::teal_data(iris = iris), - modules = modules(example_module()) - ), - expr = { - testthat::expect_false(file.exists(renv_filename)) - } - ) - } - ) + ) + testthat::expect_false(file.exists(renv_filename)) + } + ) + }) + testthat::it("creation process is not invoked for teal.lockfile.mode = \"disabled\"", { + testthat::skip_if_not_installed("mirai") + testthat::skip_if_not_installed("renv") + withr::with_options( + list(teal.lockfile.mode = "disabled"), + { + renv_filename <- "teal_app.lock" + shiny::testServer( + app = srv_teal, + args = list( + id = "test", + data = teal.data::teal_data(iris = iris), + modules = modules(example_module()) + ), + expr = { + testthat::expect_false(file.exists(renv_filename)) + } + ) + } + ) + }) }) -}) testthat::describe("srv_teal arguments", { testthat::it("accepts data to be teal_data", {