diff --git a/R/ui.R b/R/ui.R index 59192e5..5cae1e9 100644 --- a/R/ui.R +++ b/R/ui.R @@ -153,7 +153,8 @@ uiStatic <- function(data = omopgenerics::emptySummarisedResult(), if (asText) { x <- paste0("ui <- ", x) |> - styler::style_text() + styler::style_text() |> + as.character() } else { x <- x |> rlang::parse_expr() |> diff --git a/tests/testthat/_snaps/staticShiny.md b/tests/testthat/_snaps/staticShiny.md index dfcff58..7274e9c 100644 --- a/tests/testthat/_snaps/staticShiny.md +++ b/tests/testthat/_snaps/staticShiny.md @@ -1,7 +1,7 @@ # multiplication works Code - uiStatic(data = result, asText = TRUE) + cat(uiStatic(data = result, asText = TRUE), sep = "\n") Output ui <- shinydashboard::dashboardPage( shinydashboard::dashboardHeader(title = "My study"), diff --git a/tests/testthat/test-staticShiny.R b/tests/testthat/test-staticShiny.R index d28b075..01c4a37 100644 --- a/tests/testthat/test-staticShiny.R +++ b/tests/testthat/test-staticShiny.R @@ -15,6 +15,6 @@ test_that("multiplication works", { #tdir <- here::here() expect_no_error(exportStaticApp(data = result, directory = tdir)) expect_true("shiny" %in% list.files(tdir)) - expect_snapshot(uiStatic(data = result, asText = TRUE)) + expect_snapshot(uiStatic(data = result, asText = TRUE) |> cat(sep = "\n")) unlink(tdir) })