diff --git a/server/src/engine/lifecycle.test.ts b/server/src/engine/lifecycle.test.ts index d5f1f06..764aedf 100644 --- a/server/src/engine/lifecycle.test.ts +++ b/server/src/engine/lifecycle.test.ts @@ -155,6 +155,33 @@ describe('fight lifecycle', () => { expect(totalBtc + totalConsp + totalPc + totalCoding).toBeGreaterThan(1500) }) + it('narrations have variety — no repeats within a 5-round fight', () => { + let fightsWith0Repeats = 0 + const totalFights = 100 + for (let f = 0; f < totalFights; f++) { + const usedTypes = new Set() + const narrations = new Set() + let hasRepeat = false + for (let r = 0; r < 5; r++) { + const challenge = pickChallenge(usedTypes, null, undefined, r + 1) + usedTypes.add(challenge.type) + const respA = mockResponse(challenge, 'confident', 1500) + const respB = mockResponse(challenge, 'clueless', 1000) + const result = scoreRound( + challenge, { id: 'a', name: 'A' }, { id: 'b', name: 'B' }, + { answer: respA.answer, timeMs: respA.timeMs, timedOut: respA.timedOut, error: respA.error }, + { answer: respB.answer, timeMs: respB.timeMs, timedOut: respB.timedOut, error: respB.error }, + null, 0, 0, + ) + if (narrations.has(result.narration)) hasRepeat = true + narrations.add(result.narration) + } + if (!hasRepeat) fightsWith0Repeats++ + } + // At least 80% of fights should have no repeated narrations + expect(fightsWith0Repeats).toBeGreaterThan(totalFights * 0.8) + }) + it('combo buildup increases damage across rounds', () => { const challenge: Challenge = { type: 'riddle',