feat: add editorial registration and authentication

This commit is contained in:
Leon Tonhäuser committed 2026-08-09 20:48:43 +02:00
1 parent 7acaacb92e
commit 9b22752ef2
20 files changed
+1728 -20

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import { expect, test, vi } from "vitest";
import { createMailer } from "./mailer";
test("sends a verification link through the configured SMTP boundary", async () => {
const transport = { sendMail: vi.fn().mockResolvedValue({ messageId: "message-1" }) };
const mailer = createMailer({ from: "portal@example.com", transport });
await mailer.sendVerification({
to: "editorial@example.com",
verificationUrl: "https://portal.example.com/api/auth/verify-email?token=secret-token",
});
expect(transport.sendMail).toHaveBeenCalledWith({
from: "portal@example.com",
to: "editorial@example.com",
subject: "Bitte bestätigen Sie Ihre E-Mail-Adresse",
text: expect.stringContaining(
"https://portal.example.com/api/auth/verify-email?token=secret-token",
),
});
});
test("sends an approval notice without leaking SMTP credentials", async () => {
const transport = { sendMail: vi.fn().mockResolvedValue({ messageId: "message-2" }) };
const mailer = createMailer({ from: "portal@example.com", transport });
await mailer.sendApprovalNotice({ to: "editorial@example.com", editorialName: "Neue Redaktion" });
expect(transport.sendMail).toHaveBeenCalledWith({
from: "portal@example.com",
to: "editorial@example.com",
subject: "Ihr Zugang zum Redaktionsportal ist freigegeben",
text: expect.stringContaining("Neue Redaktion"),
});
});