correio/capture
Explicitly owned, bounded local capture for application tests. Captured messages contain secrets; retrieval is an explicit inspection API.
Types
A position bound to one capture. Clearing retained messages does not rewind it.
pub opaque type Checkpoint
One retained delivery, identified within its capture lifetime.
pub type Entry {
Entry(id: Int, message: message.Message)
}
Constructors
-
Entry(id: Int, message: message.Message)
pub type Error {
InvalidCapacity
Unavailable
DeadlineExceeded
}
Constructors
-
InvalidCapacity -
Unavailable -
DeadlineExceeded
Values
pub fn checkpoint(capture: Capture) -> Result(Checkpoint, Error)
Record the current position before triggering the application flow under test.
pub fn entries(capture: Capture) -> Result(List(Entry), Error)
Return retained entries in delivery order. Identifiers never repeat after clear.
pub fn messages(
capture: Capture,
) -> Result(List(message.Message), Error)
pub fn send(
capture: Capture,
message: message.Message,
) -> delivery.Outcome
pub fn sender(
capture: Capture,
) -> fn(message.Message) -> delivery.Outcome
pub fn since(
checkpoint: Checkpoint,
) -> Result(List(message.Message), Error)
Return retained messages delivered after the checkpoint, in delivery order. Inspection does not consume messages. A checkpoint may be reused.