diff --git a/tests/testthat/test-estimate_infections.R b/tests/testthat/test-estimate_infections.R index f574f3e1a..231a387aa 100644 --- a/tests/testthat/test-estimate_infections.R +++ b/tests/testthat/test-estimate_infections.R @@ -12,7 +12,7 @@ default_estimate_infections <- function(..., add_stan = list(), delay = TRUE) { control = list(adapt_delta = 0.8) ) stan_args <- def_stan[setdiff(names(def_stan), names(add_stan))] - stan_args <- c(stan_args, add_stan) + stan_args <- do.call(stan_opts, c(stan_args, add_stan)) suppressWarnings(estimate_infections(..., generation_time = generation_time_opts(example_generation_time), @@ -78,12 +78,12 @@ test_that("estimate_infections fails as expected when given a very short timeout expect_error(output <- capture.output(suppressMessages( out <- default_estimate_infections( reported_cases, - add_stan = list(future = TRUE, max_execution_time = 1) + add_stan = stan_opts(future = TRUE, max_execution_time = 1) ))), "all chains failed") expect_error(output <- capture.output(suppressMessages( out <- default_estimate_infections( reported_cases, - add_stan = list(future = FALSE, max_execution_time = 1) + add_stan = stan_opts(future = FALSE, max_execution_time = 1) ))), "timed out") }) @@ -91,7 +91,7 @@ test_that("estimate_infections fails as expected when given a very short timeout test_that("estimate_infections works as expected with failing chains", { skip_on_cran() test_estimate_infections(reported_cases, - add_stan = list( + add_stan = stan_opts( chains = 4, stuck_chains = 2, future = TRUE, control = list(adapt_delta = 0.8) @@ -99,10 +99,10 @@ test_that("estimate_infections works as expected with failing chains", { ) expect_error(default_estimate_infections(reported_cases, - add_stan = list(chains = 4, stuck_chains = 1) + add_stan = stan_opts(chains = 4, stuck_chains = 1) )) expect_error(default_estimate_infections(reported_cases, - add_stan = list( + add_stan = stan_opts( chains = 4, stuck_chains = 3, future = TRUE