Expected `app$refresh_rate <- 10.5` to throw a warning with class <lifecycle_warning_deprecated>.

test_that('handlers can be added, triggered and removed', {
rs(id1 <- app$on('test', function(...) 10))
rs(id1 <- app$on('test', function(...) 10, id = "testid"))
rs(app$on('test', function(...) 10, id = "testid")),
skip_on_os("windows") # Windows not a fan of unicode
test_that('protected events cannot be triggered', {
test_that('data can be set, get and removed', {
rs(testdata <- list(a = 1, b = 1:10, c = letters[6:10]))
expect_snapshot(rs(app$get_data(c('test', 'test2'))), error = TRUE)
test_that('plugins are being attached', {
on_attach = function(server, extraPar) {
server$on('test', function(...) 10 + extraPar)
expect_snapshot(app$attach(plugin, 15), error = TRUE)
expect_snapshot(app$attach(plugin, 10), error = TRUE)
expect_snapshot(app$plugins$test <- plugin, error = TRUE)
test_that('id converter can be set and gets called', {
app$on('request', function(server, id, ...) {
expect_snapshot(app$host <- 10, error = TRUE)
expect_snapshot(app$host <- letters[1:3], error = TRUE)
expect_snapshot(app$port <- 'test', error = TRUE)
expect_snapshot(app$port <- 1.5, error = TRUE)
expect_snapshot(app$refresh_rate_nb <- 'test', error = TRUE)
expect_snapshot(app$refresh_rate_nb <- 1:5, error = TRUE)
expect_snapshot(app$trigger_dir <- 'test', error = TRUE)
expect_snapshot(app$trigger_dir <- 1:5, error = TRUE)
test_that('life cycle events get fired', {
if (sum(server$get_data('events') == 'cycle-end') == 2) {
c('start', 'cycle-start', 'cycle-end', 'cycle-start', 'cycle-end', 'end')
app$ignite(block = FALSE, silent = TRUE)
# This no longer works in later. Messages generated during run_now() can't
#    expect_silent({ # Need to force some cycles to happen
#    }) #, 'Cannot stop server from within a non-blocking event cycle')
app$reignite(block = FALSE, silent = TRUE)
c('start', 'resume', 'cycle-start', 'cycle-end', 'end')
app$on('request', function(server, arg_list, id, request, ...) {
app$on('after-request', function(server, request, ...) {
list(test = 4, message = 'test2', binary = FALSE)
app$on('message', function(server, message, arg_list, ...) {
list(test = arg_list$test, message = message)
app$on('after-message', function(server, response, ...) {
expect_equal(app$get_data('passed_args'), list(test = 4, message = 'test2'))
app$on('header', function(server, request, ...) {
test_that('errors in start and resume gets caught', {
app$ignite(silent = TRUE, block = FALSE)
app$reignite(silent = TRUE, block = FALSE)
test_that('futures can be added and called', {
app$on('start', function(server, ...) server$set_data('time', Sys.time()))
skip_on_os('windows') # The async stuff fail on windows builders though it works fine locally
test_that('ignite is blocked during run', {
test_that('external triggers are fired', {
saveRDS(list(test = 'test'), file.path(dir, 'test.rds'))
test_that('websockets are attached, and removed', {
oldopt <- options(browser = function(url) message('Open browser at ', url))
expect_snapshot(app$ignite(showcase = TRUE, block = FALSE))
test_that('global headers are assigned and used', {
test_that('app can be mounted at path', {
expect_snapshot(app$root <- 123, error = TRUE)
expect_snapshot(app$root <- c('test', 'test2'), error = TRUE)
test_that("Logging can be configured", {
headers = list(Cookie = "fiery_id=ID_test")
test_that("requests are created with the correct settings", {
expect_snapshot(app$key <- 500, error = TRUE)
expect_snapshot(app$key <- "xyz", error = TRUE)
expect_snapshot(app$key <- "1234", error = TRUE)
expect_snapshot(app$session_cookie_settings <- "reqres", error = TRUE)
test_that("request handlers handle conditions", {
test_that("header handlers handle conditions", {
test_that("static file serving works", {
expect_snapshot(app$serve_static("/static", "test"), error = TRUE)
app$serve_static("/static", getwd(), headers = 3),
app$serve_static("/static", getwd(), headers = list("a" = 4)),