Files
Dune/tests/kull-nexus-e3-default.test.ts
T
Quintine a1b09c5b02
Verify and publish checkpoint container / container (push) Successful in 10m42s
Connect three-deck Nexus Kull and Ixian Semuta
2026-10-30 18:50:24 +11:00

50 lines
2.6 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { kullDefaultProfile, type KullDefaultProfile } from '../game/kull-default-profile';
const lobby: KullDefaultProfile = {
status: 'lobby', advanced: false, expansions: ['ix', 'choam', 'ecaz'],
players: [{faction:'choam'}, {faction:'richese'}, {faction:'atreides'}],
nexusCards: {cards:null, phase:null},
};
void test('Basic three-deck Nexus Kull quote accepts selected and unused native families', () => {
for (const extra of [[], ['ecaz'], ['moritani'], ['ecaz','moritani'], ['ixians','ecaz','moritani']]) {
const input = {...lobby, players:[...lobby.players, ...extra.map(faction => ({faction}))]};
const original = structuredClone(input);
assert.deepEqual(kullDefaultProfile(input), {eligible:true, reason:null});
assert.deepEqual(input, original);
assert.equal(kullDefaultProfile({...input, nexusCards:undefined,
lobbyModules:{nexusCards:true}}).eligible, true);
}
// Eligibility describes the available option; the caller owns host opt-out.
const options = {leaderSkills:false, kullOptOut:true};
assert.equal(kullDefaultProfile({...lobby, lobbyOptions:options}).eligible, true);
});
void test('Three-deck Nexus Kull quote preserves public roster and module restrictions', () => {
const invalid: Partial<KullDefaultProfile>[] = [
{advanced:true}, {status:'playing'},
{expansions:['ix','choam','choam']}, {expansions:['ix','choam','unknown']},
{expansions:['ix','choam'], players:[{faction:'choam'}, {faction:'ecaz'}]},
{players:[{faction:'choam'}, {faction:'ecaz'}, {faction:'ecaz'}]},
{players:[{faction:'ecaz'}, {faction:'richese'}]},
{lobbyOptions:{ecazTreachery:true}}, {lobbyOptions:{leaderSkills:true}},
{lobbyModules:{nexusCards:true, ecazTreachery:true}},
{lobbyModules:{nexusCards:true, discoveries:true}},
{homeworlds:{}}, {techTokens:{}}, {strongholdCards:{}}, {discoveryEnabled:true},
{discoveries:{}}, {discoveryStash:{}}, {greatMaker:{}}, {sandtrout:{}},
];
for (const variant of invalid) {
const result = kullDefaultProfile({...lobby, ...variant});
assert.equal(result.eligible, false, JSON.stringify(variant));
assert.ok(result.reason, 'Unavailable configurations need a readable reason');
}
});
void test('Three-deck Nexus Kull eligibility never reads private cards or funds', () => {
const ecaz = {faction:'ecaz', get hand() {throw Error('private hand read');},
get spice() {throw Error('private spice read');}};
assert.equal(kullDefaultProfile({...lobby, players:[{faction:'choam'},ecaz]}).eligible, true);
});