correio/testing

Flow assertions over an explicitly owned capture. These helpers inspect mail; they neither deliver messages nor activate links or authentication challenges.

Types

pub type Error {
  InvalidTimeout
  TimedOut
  CaptureFailed(capture.Error)
}

Constructors

Values

pub fn await(
  checkpoint: capture.Checkpoint,
  matching matching: fn(message.Message) -> Bool,
  timeout_ms timeout_ms: Int,
) -> Result(message.Message, Error)

Return the earliest retained matching message after the checkpoint. Wait duration must be 0 through 60,000 milliseconds. Zero performs one capture inspection (bounded by its one-second query timeout), without polling. Positive waits bound capture queries and polling by a monotonic deadline. Predicates run in the caller, should be pure, and may run more than once; predicate execution time and runtime scheduling remain caller-owned. Inspection is non-consuming, so the same checkpoint can return the same mail.

pub fn to(
  recipient: address.Address,
) -> fn(message.Message) -> Bool

Match a normalized envelope mailbox, including Cc and Bcc. Display names do not affect matching; domains are case-insensitive and local parts retain case.

✨ Search Document