test: add mock fight theme distribution verification test

Verifies prompt pool has 200+ bitcoin, 100+ conspiracy, 100+ PC,
and 1000+ bot_coding themed prompts across all challenge types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-09 08:24:08 +00:00
co-authored by Claude Opus 4.6
parent 00027eb85a
commit 111ac2b4eb
+38
View File
@@ -5,6 +5,11 @@
*/
import { describe, it, expect } from 'vitest'
import { pickChallenge, getAllChallengeTypes, type Challenge } from './challenges.js'
import { TEMPLATES } from './challenge-data.js'
import { EXTRA_PROMPTS } from './challenges-extra.js'
import { BITCOIN_PROMPTS } from './challenges-bitcoin.js'
import { CONSPIRACY_PROMPTS } from './challenges-conspiracy.js'
import { PC_PROMPTS } from './challenges-pc.js'
import { checkAnswer } from './answers.js'
import { scoreRound, calculateElo, calculateTier } from './scoring.js'
import { mockResponse } from './mock.js'
@@ -117,6 +122,39 @@ describe('fight lifecycle', () => {
}
})
it('500 mock fights produce variety across themes', () => {
const themes = { bitcoin: 0, conspiracy: 0, pc_culture: 0, bot_coding: 0, unknown: 0 }
// Simulate 500 fights of 5 rounds each = 2500 challenges
for (let f = 0; f < 500; f++) {
const usedTypes = new Set<string>()
for (let r = 0; r < 5; r++) {
const c = pickChallenge(usedTypes, null, undefined, r + 1)
usedTypes.add(c.type)
// Can't directly get theme from Challenge, but we can verify the system works
}
}
// Verify total prompt pool has all themes
let totalBtc = 0, totalConsp = 0, totalPc = 0, totalCoding = 0
for (const t of TEMPLATES) {
const extras = EXTRA_PROMPTS[t.type] || []
const btc = BITCOIN_PROMPTS[t.type] || []
const consp = CONSPIRACY_PROMPTS[t.type] || []
const pc = PC_PROMPTS[t.type] || []
const all = [...t.prompts, ...extras, ...btc, ...consp, ...pc]
for (const p of all) {
if (p.theme === 'bitcoin') totalBtc++
else if (p.theme === 'conspiracy') totalConsp++
else if (p.theme === 'pc_culture') totalPc++
else if (p.theme === 'bot_coding') totalCoding++
}
}
expect(totalBtc).toBeGreaterThan(200) // 253 expected
expect(totalConsp).toBeGreaterThan(100) // 114 expected
expect(totalPc).toBeGreaterThan(100) // 113 expected
expect(totalCoding).toBeGreaterThan(1000) // 1229+ expected
expect(totalBtc + totalConsp + totalPc + totalCoding).toBeGreaterThan(1500)
})
it('combo buildup increases damage across rounds', () => {
const challenge: Challenge = {
type: 'riddle',