feat(auth): Story 2.2 — Mailer (nodemailer + Konsolen-Fallback)

This commit is contained in:
Kenearos 2026-07-07 22:37:02 +02:00
parent 08c32bcf0f
commit b08988c2a5
2 changed files with 50 additions and 0 deletions

15
server/mailer.test.js Normal file
View file

@ -0,0 +1,15 @@
const { test } = require('node:test');
const assert = require('node:assert');
delete process.env.SMTP_HOST;
const { sendMagicLink, getTransport } = require('./mailer');
test('ohne SMTP: getTransport null', () => {
assert.strictEqual(getTransport(), null);
});
test('ohne SMTP: Konsolen-Fallback, kein Wurf, url zurück', async () => {
const r = await sendMagicLink('a@x.de', 'https://bonus.example/auth?token=abc');
assert.strictEqual(r.sent, false);
assert.strictEqual(r.url, 'https://bonus.example/auth?token=abc');
});