Files
Dune/tests/kull-nexus-richese-default.test.ts
T
Quintine e697d7f558
Verify and publish checkpoint container / container (push) Successful in 10m47s
Connect Semuta with Nexus Kull in Basic games
2026-10-30 18:40:01 +11:00

45 lines
2.4 KiB
TypeScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { kullDefaultEligible, kullDefaultProfile, type KullDefaultProfile } from '../game/kull-default-profile';
const lobby: KullDefaultProfile = {
status: 'lobby', advanced: false, expansions: ['choam', 'ix'],
players: [{ faction: 'choam' }, { faction: 'richese' }, { faction: 'atreides' }],
nexusCards: { cards: null, phase: null },
};
void test('Basic Nexus Kull public quote admits Richese with either or both native Ix factions', () => {
for (const factions of [[], ['ixians'], ['tleilaxu'], ['ixians', 'tleilaxu']]) {
const selected = { ...lobby, players: [...lobby.players, ...factions.map(faction => ({ faction }))] };
assert.deepEqual(kullDefaultProfile(selected), { eligible: true, reason: null });
assert.equal(kullDefaultEligible({ ...selected, nexusCards: undefined, lobbyModules: { nexusCards: true } }), true);
}
// Explicit host opt-out is handled by the lobby caller, not eligibility.
const optedOut = { leaderSkills: false, kullOptOut: true };
assert.equal(kullDefaultEligible({ ...lobby, lobbyOptions: optedOut }), true);
});
void test('Richese Nexus Kull retains independent Basic roster and module guards', () => {
const invalid: Partial<KullDefaultProfile>[] = [
{ advanced: true }, { status: 'playing' }, { expansions: ['choam'] },
{ expansions: ['choam', 'ix', 'ecaz'] },
{ players: [{ faction: 'richese' }, { faction: 'atreides' }] },
{ players: [{ faction: 'choam' }, { faction: 'richese' }, { faction: 'richese' }] },
{ players: [{ faction: 'choam' }, { faction: 'richese' }, { faction: 'ecaz' }] },
{ lobbyOptions: { leaderSkills: true } }, { lobbyOptions: { ecazTreachery: true } },
{ lobbyModules: { nexusCards: true, discoveries: true } }, { homeworlds: {} },
{ techTokens: {} }, { strongholdCards: {} }, { discoveryEnabled: true },
];
for (const variant of invalid) {
const result = kullDefaultProfile({ ...lobby, ...variant });
assert.equal(result.eligible, false, JSON.stringify(variant));
assert.ok(result.reason, 'Unavailable lobbies need a readable reason');
}
});
void test('Richese Nexus Kull quote reads no player hand or spice', () => {
const richese = { faction: 'richese', get hand() { throw Error('private hand read'); },
get spice() { throw Error('private spice read'); } };
assert.equal(kullDefaultEligible({ ...lobby, players: [{ faction: 'choam' }, richese] }), true);
});