Created
April 28, 2020 22:27
-
-
Save alandipert/c1f3a56d99bf8a9186178b5ad271c7dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
library(promises) | |
library(future) | |
library(shiny) | |
library(testthat) | |
plan(multiprocess) | |
adderModule <- function(id, sleepFor, n) { | |
moduleServer(id, function(input, output, session) { | |
output$sum <- renderText({ | |
future({ Sys.sleep(sleepFor); n }) %...>% | |
{ . + input$n } %...>% | |
as.character() | |
}) | |
}) | |
} | |
testServer(adderModule, { | |
session$setInputs(n = 10) | |
timing <- system.time({ | |
expect_equal(output$sum, "20") | |
}) | |
expect_gt(timing[[3]], 4) | |
}, sleepFor = 5, n = 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment