Completa la copertura test del badge MVP e riscrive la doc del modulo badge

Aggiunge il caso positivo RLS mancante per mvp_voti in permessi.test.ts e un nuovo
test end-to-end (mvp-badge.test.ts) che verifica l'intera pipeline voti reali ->
mvpVintiPerGiocatore() -> statoBadge(). docs/modules/badge.md ora elenca tutti e 16
i badge con come funzionano, la copertura test badge per badge e i due problemi
minori trovati in audit (badgeSbloccati() morta, categoria senza vincolo DB).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 13:38:30 +02:00
co-authored by Claude Sonnet 5
parent 9b81fcf2fc
commit c7588c5aa2
3 changed files with 325 additions and 2 deletions
+12
View File
@@ -311,6 +311,18 @@ if (!locale) {
});
assert.ok(!falso.ok, `non si vota a nome di un altro (${falso.status})`);
const mioMvp = await rest("mvp_voti", tokenGiocatore, {
method: "POST",
headers: { Prefer: "resolution=merge-duplicates,return=representation" },
body: JSON.stringify({
match_id: EVENTO,
votante_id: "g1",
votato_id: "g5",
votato_nome: "Cinque",
}),
});
assert.equal(await righeToccate(mioMvp), 1, "il proprio voto MVP si registra");
const mvp = await rest("mvp_voti", tokenGiocatore, {
method: "POST",
headers: { Prefer: "resolution=merge-duplicates,return=representation" },