Migration m22: coda notifiche_email_coda, preferenze_utente, trigger che accoda ogni notifica di notifiche_utente e tre funzioni RPC riservate alla service role. Worker in mailer/ (bun + nodemailer, solo polling in uscita) con backoff, tetto giornaliero e healthcheck. Interruttore «Email» in Profilo → Opzioni, acceso di default. Test unit e di integrazione; documentazione aggiornata (DD-036 accettata). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
17 lines
629 B
TypeScript
17 lines
629 B
TypeScript
/** Preferenze dell'account (M22): `bun test/unit/preferenze-utente.test.ts`. */
|
|
import assert from "node:assert/strict";
|
|
import { emailAttive } from "@/lib/preferenze-utente";
|
|
import { prova, riepilogo } from "../helpers/prova";
|
|
|
|
await prova("senza riga le email sono attive (default DD-036)", () => {
|
|
assert.equal(emailAttive(null), true);
|
|
assert.equal(emailAttive(undefined), true);
|
|
});
|
|
|
|
await prova("con la riga vale il valore scelto dal giocatore", () => {
|
|
assert.equal(emailAttive({ email_notifiche: true }), true);
|
|
assert.equal(emailAttive({ email_notifiche: false }), false);
|
|
});
|
|
|
|
riepilogo("preferenze-utente");
|