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.
pub opaque type TestSession(model, msg)
Values
pub fn current_tree(
session: TestSession(model, msg),
) -> node.Node
Return the current normalized tree.
pub fn get_app(
session: TestSession(model, msg),
) -> app.App(model, msg)
Return the underlying app (for helpers that need access).
pub fn send_event(
session: TestSession(model, msg),
event: msg,
) -> TestSession(model, msg)
Dispatch an event through the app’s update function. Processes resulting commands and re-renders the view.
pub fn start(app: app.App(model, msg)) -> TestSession(model, msg)
Create a new test session from an app. Calls init, processes commands, renders and normalizes the initial view.