import assert from 'node:assert/strict'; import test from 'node:test'; import { basicKullLeaderSkillsProfile, type FactionModuleProfile } from '../game/faction-module-profile'; import { independentTreacheryLeaderSkillsProfile, ordinaryLeaderSkillModeSupported } from '../game/leader-skill-profile'; import { bureaucratPaymentModeSupported, quoteBureaucratPayment } from '../game/bureaucrat-payment'; import { mentatQuestionModeSupported } from '../game/mentat-question'; import { spiceBankerModeSupported } from '../game/spice-banker'; const original: FactionModuleProfile = { advanced: false, expansions: ['ix', 'choam', 'ecaz'], players: [{ faction: 'choam' }, { faction: 'richese' }, { faction: 'ecaz' }], leaderSkills: {}, }; void test('Basic Kull and Skills retain public skill authority through setup and the live Kull stamp', () => { for (const independent of [false, true]) for (const semuta of [false, true]) for (const stamped of [false, true]) { const game = { ...original, ecazTreachery: independent, ...(semuta ? { semutaPreview: true } : {}), ...(stamped ? { kullPreview: true } : {}) }; const label = `independent=${independent}, semuta=${semuta}, stamped=${stamped}`; assert.equal(basicKullLeaderSkillsProfile(game), true, label); assert.equal(independentTreacheryLeaderSkillsProfile(game), independent, label); assert.equal(ordinaryLeaderSkillModeSupported(game), true, label); assert.equal(mentatQuestionModeSupported(game), true, label); assert.equal(spiceBankerModeSupported(game), true, label); assert.equal(bureaucratPaymentModeSupported(game), true, label); } }); void test('Bureaucrat retains the ordinary amount threshold and phase limit', () => { const game = { ...original, ecazTreachery: true, semutaPreview: true, kullPreview: true }; assert.equal(bureaucratPaymentModeSupported(game), true); const payment = { owner: 'ecaz', payer: 'choam', payee: 'richese', amount: 7, turn: 2, phase: 3, used: [] }; assert.deepEqual(quoteBureaucratPayment(payment), { redirect: 2, income: 5 }); assert.equal(quoteBureaucratPayment({ ...payment, amount: 4 }), null); assert.equal(quoteBureaucratPayment({ ...payment, used: [{ event: 'used', owner: 'ecaz', turn: 2, phase: 3, signature: '' }] }), null); }); void test('standalone Kull and Skills reject unrelated modules and unregistered rosters', () => { const invalid: Array<[string, Partial]> = [ ['Advanced', { advanced: true }], ['missing Skills', { leaderSkills: null }], ['Nexus', { nexusCards: {} }], ['Nexus Kull stamp', { nexusKullPreview: true }], ['no CHOAM seat', { players: [{ faction: 'richese' }, { faction: 'ecaz' }] }], ['duplicate faction', { players: [{ faction: 'choam' }, { faction: 'choam' }] }], ['unselected faction', { expansions: ['ix', 'choam'] }], ['duplicate deck', { expansions: ['ix', 'choam', 'ix'] }], ['missing Ix deck', { expansions: ['choam', 'ecaz'] }], ['Homeworlds', { homeworlds: {} }], ['Discovery', { discoveryEnabled: true }], ['Tech', { techTokens: {} }], ['Strongholds', { strongholdCards: {} }], ['unrelated betrayal', { richeseBetrayalPreview: true }], ['Semuta without Richese', { semutaPreview: true, players: [{ faction: 'choam' }, { faction: 'ecaz' }] }], ]; for (const [label, changes] of invalid) assert.equal(basicKullLeaderSkillsProfile({ ...original, ...changes }), false, label); });