# =========================================================================== # executeSpec — input validation # =========================================================================== test_that("executeSpec errors on NULL connection", { spec <- structure(list(analysisId = 1L), class = "singleNodeSpec") expect_error( executeSpec(connection = NULL, spec = spec), "connection.*must be a DatabaseConnector" ) }) test_that("executeSpec errors on non-DatabaseConnector connection", { spec <- structure(list(analysisId = 1L), class = "singleNodeSpec") expect_error( executeSpec(connection = "not_a_conn", spec = spec), "connection.*must be a DatabaseConnector" ) }) test_that("executeSpec errors on non-singleNodeSpec", { fake_conn <- structure(list(), class = "DatabaseConnectorConnection") expect_error( executeSpec(connection = fake_conn, spec = list(analysisId = 1L)), "spec.*must be a.*singleNodeSpec" ) }) # =========================================================================== # executeSpecs — input validation # =========================================================================== test_that("executeSpecs errors on NULL connection", { specs <- structure(list(), class = "singleNodeSettingList") expect_error( executeSpecs(connection = NULL, specs = specs), "connection.*must be a DatabaseConnector" ) }) test_that("executeSpecs errors on non-DatabaseConnector connection", { specs <- structure(list(), class = "singleNodeSettingList") expect_error( executeSpecs(connection = "bad", specs = specs), "connection.*must be a DatabaseConnector" ) }) test_that("executeSpecs errors on non-singleNodeSettingList", { fake_conn <- structure(list(), class = "DatabaseConnectorConnection") expect_error( executeSpecs(connection = fake_conn, specs = list()), "specs.*must be a.*singleNodeSettingList" ) }) test_that("executeSpecs validates stopOnError parameter", { fake_conn <- structure(list(), class = "DatabaseConnectorConnection") specs <- structure(list(), class = "singleNodeSettingList") expect_error( executeSpecs(connection = fake_conn, specs = specs, stopOnError = "yes"), "stopOnError" ) })