Aggiunge copertura test e documentazione per Notifiche attive in admin
Estrae la deduplica degli id giocatore in idsConNotificheAttive (src/lib/notifiche-attive.server.ts), testata a livello unit. Aggiunge un test di integrazione sui permessi della route (401/403/200), sullo stesso schema di permessi-route.test.ts. Documenta il nuovo endpoint in notifiche.md e la dashboard admin a tab in profilo-giocatore.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Check della deduplica per la sezione Notifiche in admin:
|
||||
* `bun test/unit/notifiche-attive.test.ts`.
|
||||
*/
|
||||
import assert from "node:assert/strict";
|
||||
import { idsConNotificheAttive } from "@/lib/notifiche-attive.server";
|
||||
|
||||
assert.deepEqual(idsConNotificheAttive([]), [], "nessuna riga -> nessun id");
|
||||
|
||||
assert.deepEqual(idsConNotificheAttive([{ giocatore_id: "g1" }]), ["g1"], "una riga -> un id");
|
||||
|
||||
assert.deepEqual(
|
||||
idsConNotificheAttive([{ giocatore_id: "g1" }, { giocatore_id: "g1" }, { giocatore_id: "g2" }]),
|
||||
["g1", "g2"],
|
||||
"più dispositivi dello stesso giocatore contano una volta sola",
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
idsConNotificheAttive([{ giocatore_id: "g2" }, { giocatore_id: "g1" }]),
|
||||
["g2", "g1"],
|
||||
"ordine di prima comparsa, non alfabetico",
|
||||
);
|
||||
|
||||
console.log("notifiche-attive: ok");
|
||||
Reference in New Issue
Block a user