Copre la logica pura isolabile di avatar-store, error-capture, error-page, lovable-error-reporting, profili (validazione upload), push-client (guardie senza DOM), scout-stato e webpush.server (firma JWT VAPID con chiavi P-256 generate al volo, fetch intercettato). Alza i file di src/lib coperti da 19 a 28 su 37, senza introdurre nuove dipendenze. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
17 lines
690 B
TypeScript
17 lines
690 B
TypeScript
/**
|
|
* Check dell'avatar giocatore: `bun test/unit/avatar-store.test.ts`.
|
|
* `urlAvatar` è puro (il bucket è pubblico, nessuna richiesta di rete): qui
|
|
* verifichiamo solo la forma dell'URL, non serve un database.
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { urlAvatar } from "@/lib/avatar-store";
|
|
|
|
const url = urlAvatar("g1");
|
|
|
|
assert.ok(url.includes("avatar-giocatori"), "punta al bucket degli avatar");
|
|
assert.ok(url.includes("g1/avatar.jpg"), "il percorso è <id>/avatar.jpg");
|
|
assert.equal(urlAvatar("g1"), url, "deterministico: nessuna chiamata di rete coinvolta");
|
|
assert.notEqual(urlAvatar("g2"), url, "id diversi -> percorsi diversi");
|
|
|
|
console.log("avatar-store: ok");
|