This function runs a battery of tests of the given diseasystore.
The supplied diseasystore must be a generator for the diseasystore, not an instance of the diseasystore.
The tests assume that data has been made available locally to run the majority of the tests. The location of the local data should be configured in the options for "source_conn" of the given diseasystore before calling test_diseasystore.
Usage
test_diseasystore(
diseasystore_generator = NULL,
conn_generator = NULL,
data_files = NULL,
target_schema = "test_ds",
test_start_date = NULL,
...
)
Arguments
- diseasystore_generator
(
Diseasystore*
)
The diseasystore R6 class generator to test.- conn_generator
(
function
)
Function that generates alist
() of connections use as target_conn.- data_files
(
character()
)
List of files that should be available when testing.- target_schema
(
character(1)
)
The data base schema where the tests should be run.- test_start_date
(
Date
)
The earliest date to retrieve data from during tests.- ...
Other parameters passed to the diseasystore generator.
Examples
# \donttest{
withr::local_options("diseasystore.DiseasystoreEcdcRespiratoryViruses.pull" = FALSE)
test_diseasystore(
DiseasystoreEcdcRespiratoryViruses,
\() list(DBI::dbConnect(RSQLite::SQLite())),
data_files = "data/snapshots/2023-11-24_ILIARIRates.csv",
target_schema = "test_ds",
test_start_date = as.Date("2022-06-20"),
slice_ts = "2023-11-24"
)
#> Test passed
#> Test passed
#> -- Failure: DiseasystoreEcdcRespiratoryViruses can initialise with default source_conn --
#> Expected `ds$get_feature(ds$available_features[[1]])` to run without any errors.
#> i Actually got a <purrr_error_indexed> with text:
#> i In index: 1.
#> Caused by error in `source_conn_github()`:
#> ! The directory /tmp/RtmphqjWYG does not appear to be a git repository. Cannot pull.
#>
#> Error: Test failed
# }