Jest

Per-test disposable inboxes.

import { Ephemail } from "@ephemail/sdk";
const ephemail = new Ephemail({ apiKey: process.env.EPHEMAIL_KEY! });

test("password reset email arrives", async () => {
  const addr = await ephemail.addresses.create({ ttlSeconds: 300 });
  await fetch("/password/reset", { method: "POST", body: JSON.stringify({ email: addr.email }) });
  const msg = await ephemail.addresses(addr.email).waitForMessage({
    matchSubject: /reset/i, timeoutMs: 30_000,
  });
  expect(msg.links?.length).toBeGreaterThan(0);
}, 60_000);