Skip to content

Commit

Permalink
Merge branch '1187_decorate_output@main' of https://github.com/insigh…
Browse files Browse the repository at this point in the history
…tsengineering/teal into 1187_decorate_output@main
  • Loading branch information
m7pr committed Nov 11, 2024
2 parents 6eccdb8 + c36ab66 commit 6843cc8
Showing 1 changed file with 51 additions and 52 deletions.
103 changes: 51 additions & 52 deletions tests/testthat/test-module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down

0 comments on commit 6843cc8

Please sign in to comment.