import { describe, expect, test } from "vitest"; import { renderReactEmail } from "../render-helpers.js"; import { defaultMailBrand } from "../_layout/theme.js"; import { InvalidActionUrlError } from "../_layout/Button.js"; import { MagicLinkEmail } from "./MagicLink.js"; describe("MagicLinkEmail", () => { test("renders default snapshot", () => { const result = renderReactEmail( ); expect(result.html).toMatchSnapshot("html"); expect(result.text).toMatchSnapshot("text"); }); test("emits expiry InfoBox copy", () => { const { html } = renderReactEmail( ); expect(html).toContain("expires in 10 minutes"); }); test("rejects javascript: action URL", () => { expect(() => renderReactEmail() ).toThrow(InvalidActionUrlError); }); });