plushie/testing/backend/mock

Pooled test backend sharing a single renderer process.

Each test gets its own session managed by a SessionPool. Wire I/O goes through the shared pool while model, tree, and event dispatch are managed locally. This enables concurrent test execution against one renderer process.

Usage

Start a pool in test setup:

let assert Ok(pool) = session_pool.start(
  session_pool.PoolConfig(..session_pool.default_config(),
    renderer_path: Some("/path/to/plushie"),
  ),
)

Create the backend:

let backend = pooled.backend(pool)

Types

One interact batch from the renderer. InteractStep is an intermediate batch that must be followed by a snapshot back to the renderer; InteractResponse is the final batch. InteractTimeout indicates the renderer failed to reply in time.

pub type InteractBatch {
  InteractStep(events: List(dynamic.Dynamic))
  InteractResponse(events: List(dynamic.Dynamic))
  InteractTimeout
}

Constructors

Values

pub fn backend(
  pool: process.Subject(session_pool.PoolMessage),
) -> backend.TestBackend(model)

Create a pooled test backend.

Search Document