Files
Dune/tests/nexus-kull-skills-profile.test.ts
T
Quintine 4270b36be7
Verify and publish checkpoint container / container (push) Successful in 10m45s
Connect Nexus Skills and Advanced Ambassador markers
2026-11-16 16:23:53 +11:00

69 lines
3.4 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import {
independentNexusProfile, nexusCoreProfile, nexusKullLeaderSkillsProfile,
type FactionModuleProfile,
} from '../game/faction-module-profile';
import { 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' }],
nexusCards: {},
leaderSkills: {},
ecazTreachery: true,
semutaPreview: true,
};
void test('Basic Nexus, Kull and Skills retain the same public authority before and after Kull stamps', () => {
for (const independent of [false, true]) for (const stamped of [false, true]) {
const game = { ...original, ecazTreachery: independent,
...(stamped ? { kullPreview: true, nexusKullPreview: true } : {}) };
const label = `independent=${independent}, stamped=${stamped}`;
assert.equal(nexusKullLeaderSkillsProfile(game), true, label);
assert.equal(nexusCoreProfile(game), true, label);
assert.equal(independentNexusProfile(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 keeps its ordinary once-per-phase quote in this supported composition', () => {
const game = { ...original, kullPreview: true, nexusKullPreview: 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('the Kull and Skills profile rejects unmatched stamps and unrelated module overlays', () => {
const invalid: Array<[string, Partial<FactionModuleProfile>]> = [
['Advanced', { advanced: true }],
['missing Nexus', { nexusCards: null }],
['missing Skills', { leaderSkills: null }],
['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'] }],
['only Kull stamp', { kullPreview: true }],
['only Nexus Kull stamp', { nexusKullPreview: true }],
['Homeworlds', { homeworlds: {} }],
['Discovery', { discoveryEnabled: true }],
['Tech', { techTokens: {} }],
['Strongholds', { strongholdCards: {} }],
['unrelated betrayal', { richeseBetrayalPreview: true }],
['Semuta without Richese', { players: [{ faction: 'choam' }, { faction: 'ecaz' }] }],
];
for (const [label, patch] of invalid)
assert.equal(nexusKullLeaderSkillsProfile({ ...original, ...patch }), false, label);
});