diff --git a/tests/testthat/test-init.R b/tests/testthat/test-init.R index 01aa0a85dd..b19df7aad7 100644 --- a/tests/testthat/test-init.R +++ b/tests/testthat/test-init.R @@ -149,23 +149,6 @@ testthat::test_that("init data accepts teal_data_module", { ) }) -testthat::test_that("init teal_data_module doesn't accept ui and server with other formals than id", { - testthat::expect_error( - init( - data = teal_data_module(ui = function(id, x) div(), server = function(id) NULL), - modules = modules(teal:::example_module()) - ), - "Must have exactly 1 formal arguments" - ) - testthat::expect_error( - init( - data = teal_data_module(ui = function(id) div(), server = function(id, x) NULL), - modules = modules(teal:::example_module()) - ), - "Must have exactly 1 formal arguments" - ) -}) - testthat::test_that("init modules accepts a teal_modules object", { mods <- modules(example_module(), example_module()) testthat::expect_no_error(init(data = iris, modules = mods)) diff --git a/tests/testthat/test-module_nested_tabs.R b/tests/testthat/test-module_nested_tabs.R index 858f2cc460..f4479988b9 100644 --- a/tests/testthat/test-module_nested_tabs.R +++ b/tests/testthat/test-module_nested_tabs.R @@ -486,9 +486,9 @@ testthat::test_that("calculate_hashes takes a FilteredData and vector of datanam datasets <- teal.slice::init_filtered_data( list( - ADSL = list(dataset = head(adsl)), - ADAE = list(dataset = head(adae)), - ADTTE = list(dataset = head(adtte)) + ADSL = list(dataset = adsl), + ADAE = list(dataset = adae), + ADTTE = list(dataset = adtte) ) ) diff --git a/tests/testthat/test-module_teal_with_splash.R b/tests/testthat/test-module_teal_with_splash.R index 243a8d782f..24677bc0d8 100644 --- a/tests/testthat/test-module_teal_with_splash.R +++ b/tests/testthat/test-module_teal_with_splash.R @@ -42,7 +42,7 @@ testthat::test_that("srv_teal_with_splash raw_data evaluates the server of teal_ ) }) -testthat::test_that("srv_teal_with_splash passes teal_data to reactiveVal", { +testthat::test_that("srv_teal_with_splash passes teal_data to reactive", { shiny::testServer( app = srv_teal_with_splash, args = list( diff --git a/tests/testthat/test-teal_data_module.R b/tests/testthat/test-teal_data_module.R new file mode 100644 index 0000000000..93d20d203b --- /dev/null +++ b/tests/testthat/test-teal_data_module.R @@ -0,0 +1,20 @@ +testthat::test_that("teal_data_module returns teal_data_module", { + testthat::expect_s3_class( + teal_data_module(ui = function(id) div(), server = function(id) NULL), + "teal_data_module" + ) +}) + +testthat::test_that("teal_data_module throws when ui has other formals than id only", { + testthat::expect_error( + teal_data_module(ui = function(id, x) div(), server = function(id) NULL), + "Must have exactly 1 formal arguments" + ) +}) + +testthat::test_that("teal_data_module throws when server has other formals than id only", { + testthat::expect_error( + teal_data_module(ui = function(id) div(), server = function(id, x) NULL), + "Must have exactly 1 formal arguments" + ) +})