import type { Email } from "../email.mjs"; import type { EmailMessage } from "../types.mjs"; /** An `Email` instance plus an `inbox` that records every message sent * through it. Use in tests instead of stubbing providers by hand. */ export interface TestEmail extends Email { readonly inbox: readonly EmailMessage[]; /** The most recent message, or `undefined` if the inbox is empty. */ readonly last: EmailMessage | undefined; /** Find the first message matching a predicate. */ find: (predicate: (msg: EmailMessage) => boolean) => EmailMessage | undefined; /** All messages matching a predicate. */ filter: (predicate: (msg: EmailMessage) => boolean) => EmailMessage[]; /** Wait up to `timeout` ms for a matching message to arrive. Resolves * with the message; rejects on timeout. */ waitFor: (predicate: (msg: EmailMessage) => boolean, options?: { timeout?: number; interval?: number; }) => Promise; /** Empty the inbox without disposing the driver. */ clear: () => void; } export interface CreateTestEmailOptions { /** Pre-populate the inbox (useful for regression fixtures). */ inbox?: EmailMessage[]; /** Pass through to the underlying mock driver. */ fail?: boolean; } /** Shorthand for tests: `createTestEmail()` returns a working `Email` with * an `inbox` you can assert against. Exposed under `unemail/test`. */ export declare function createTestEmail(options?: CreateTestEmailOptions): TestEmail;