test: verify narration variety — no repeats within 5-round fights

Runs 100 simulated fights and verifies 80%+ have zero repeated
narrations across 5 rounds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 08:24:42 +00:00
co-authored by Claude Opus 4.6
parent 111ac2b4eb
commit 4dc350dc9e
+27
View File
@@ -155,6 +155,33 @@ describe('fight lifecycle', () => {
expect(totalBtc + totalConsp + totalPc + totalCoding).toBeGreaterThan(1500) 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<string>()
const narrations = new Set<string>()
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', () => { it('combo buildup increases damage across rounds', () => {
const challenge: Challenge = { const challenge: Challenge = {
type: 'riddle', type: 'riddle',