plushie/testing/session
Test session: immutable state wrapper for the Elm loop.
A TestSession holds the current model, normalized tree, and app
reference. Each operation (send_event, click, etc.) returns a new
session with updated state. No processes, no side effects: pure
functional state threading.
Types
Immutable test session. Each operation returns a new session.
The msg type is always Event because the testing infrastructure
only works with simple apps (or apps whose on_event maps to Event).
pub opaque type TestSession(model)
Values
pub fn current_tree(session: TestSession(model)) -> node.Node
Return the current normalized tree.
pub fn get_app(
session: TestSession(model),
) -> app.App(model, event.Event)
Return the underlying app (for helpers that need access).
pub fn send_event(
session: TestSession(model),
event: event.Event,
) -> TestSession(model)
Dispatch an event through the app’s update function. Processes resulting commands and re-renders the view.
pub fn start(
app: app.App(model, event.Event),
) -> TestSession(model)
Create a new test session from an app. Calls init, processes commands, renders and normalizes the initial view.