From 4dc350dc9ed7006680b6a8cd89f3b803e9717733 Mon Sep 17 00:00:00 2001 From: Dorian Date: Mon, 9 Mar 2026 08:24:42 +0000 Subject: [PATCH] =?UTF-8?q?test:=20verify=20narration=20variety=20?= =?UTF-8?q?=E2=80=94=20no=20repeats=20within=205-round=20fights?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runs 100 simulated fights and verifies 80%+ have zero repeated narrations across 5 rounds. Co-Authored-By: Claude Opus 4.6 --- server/src/engine/lifecycle.test.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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',