Several utilities for unit testing, mainly with shiny::testServer() that
have proven themselves useful for testing this package are exported for
re-use in other packages.
generate_plugin_args(board, ..., mode = c("edit", "read"))sink_msg(...)
new_mock_session()
with_mock_session(expr, session = new_mock_session())
with_mock_context(session, expr)
get_s3_method(generic, object)
export_safely(x)
For testing plugins, generate_plugin_args() returns objects that
mimic how plugins are called in the board server (with reactive components
re-created on a NULL reactive domain so they outlive the
shiny::testServer() session used to set them up), sink_msg() is called
mainly for the side-effect of muting shiny messages (and returns them
invisibly), with_mock_session() returns NULL (invisibly) and
with_mock_context() returns the result of a call to
shiny::withReactiveDomain(). Finally, get_s3_method() returns a
class-specific implementation of the specified generic (and throws an error
if none is found).
A board object
Forwarded to utils::capture.output()
Edit plugins, such as manage_blocks get an additional argument
update over read plugins such as preserve_board.
Test code containing expectations. The objects from inside the
server function environment will be made available in the environment of
the test expression (this is done using a data mask with
rlang::eval_tidy()). This includes the parameters of the server function
(e.g. input, output, and session), along with any other values
created inside of the server function.
The MockShinySession object to use as the reactive domain. The same session object is used as the domain both
during invocation of the server or module under test and during evaluation
of expr.
Generic function name (passed as string)
S3 Object
Reactive object to use in shiny::exportTestValues()