test(referto): copri generaReferto e il branch guest di vincitoreSet

buildRefertoHtml mancava il caso vinc nullo con guest in vantaggio;
generaReferto (window.open/print) non era testato affatto perché
richiede un DOM — aggiunto un test component in happy-dom che mocka
window.open.
This commit is contained in:
2026-07-03 11:59:28 +02:00
parent fdd1d0c990
commit 2625284e99
2 changed files with 40 additions and 0 deletions
+9
View File
@@ -60,6 +60,15 @@ describe('buildRefertoHtml (referto.js)', () => {
expect(html).toContain('1 0')
})
it('ricava il vincitore guest dal conteggio punti se vinc è nullo', () => {
const striscia = [
{ serv: 'h', ris: 'g'.repeat(25) + 'h'.repeat(20), vinc: null },
]
const html = buildRefertoHtml(statoConSet(striscia), NOW)
// conteggio punti guest > home, pur con vinc null → 0 1
expect(html).toContain('0 1')
})
it('include la progressione punto-punto con classi per squadra', () => {
const striscia = [
{ serv: 'h', ris: 'hhg', vinc: null },