Connect Harkonnen Nexus to Ecaz Occupy
Verify and publish checkpoint container / container (push) Successful in 11m17s
Verify and publish checkpoint container / container (push) Successful in 11m17s
This commit is contained in:
1 parent
007508185e
commit
a2e7029a72
12 files changed
+529
-19
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { leaders, treacheryDeck } from '../game/cards';
|
||||
import { NEXUS_FACTIONS, type NexusPlayer } from '../game/nexus-cards';
|
||||
import {
|
||||
closeHarkonnenBetrayalSource, createHarkonnenBetrayalSource, initialHarkonnenBetrayalCursor,
|
||||
validateHarkonnenBetrayalHistory, validateHarkonnenBetrayalSource,
|
||||
type HarkonnenBetrayalAuthority, type HarkonnenBetrayalContext,
|
||||
} from '../game/nexus-harkonnen-betrayal';
|
||||
import { createTraitorDeclaration } from '../game/traitor-declarations';
|
||||
import { traitorDeck } from '../game/traitors';
|
||||
|
||||
/** A source using the exact old two-plan context, including its original
|
||||
* physical snapshot and source constructor. This is helper compatibility, not
|
||||
* evidence of a resumed room or an independently reproduced Basic battle. */
|
||||
void test('the prior two-plan Harkonnen source remains readable and closable', () => {
|
||||
const players: NexusPlayer[] = [
|
||||
{id:'e', faction:'ecaz', ally:'g'},
|
||||
{id:'g', faction:'guild', ally:'e'},
|
||||
{id:'h', faction:'harkonnen', ally:null},
|
||||
{id:'a', faction:'atreides', ally:null},
|
||||
];
|
||||
const universe = traitorDeck(players.map(p => ({leaders:leaders(p.faction)})));
|
||||
const held = 'ecaz-0';
|
||||
const ctx: HarkonnenBetrayalContext = {
|
||||
status:'playing', phase:6, turn:2, advanced:false, sequence:0, expansions:['ecaz'],
|
||||
players, universe, physicalCards:treacheryDeck(['ecaz']),
|
||||
cards:{version:1, deck:NEXUS_FACTIONS.filter(id => id !== 'harkonnen'), discard:[],
|
||||
hands:Object.fromEntries(players.map(p => [p.id, p.id === 'a' ? 'harkonnen' : null]))},
|
||||
traitors:{reserve:universe.filter(id => id !== held),
|
||||
players:players.map(p => ({id:p.id, faction:p.faction, traitors:p.id === 'h' ? [held] : []}))},
|
||||
battle:{event:'old-basic-occupy-battle', attacker:'h', defender:'e',
|
||||
plans:{h:{leader:'harkonnen-0'}, e:{leader:held}}, heroLeaderIds:[]},
|
||||
};
|
||||
const declaration = createTraitorDeclaration({...ctx.battle,
|
||||
players:players.map(p => ({...p, traitors:p.id === 'h' ? [held] : []}))}, 'h');
|
||||
const authority: HarkonnenBetrayalAuthority = {provider:'h', declaration,
|
||||
nativeWindow:'direct', nativeContext:'original-native-context', nativeRequired:[], nativePassed:[]};
|
||||
const source = createHarkonnenBetrayalSource(ctx, authority, 'original-battle-parent');
|
||||
assert.equal(Object.hasOwn(source.battle, 'ecazOccupy'), false);
|
||||
const restored = JSON.parse(JSON.stringify(source)) as typeof source;
|
||||
validateHarkonnenBetrayalSource(ctx, restored, authority, 'original-battle-parent');
|
||||
const closed = closeHarkonnenBetrayalSource(restored, 'use', 'a', initialHarkonnenBetrayalCursor());
|
||||
validateHarkonnenBetrayalHistory([closed.receipt], closed.cursor, universe);
|
||||
assert.equal(closed.receipt.source.declaration.identity, held);
|
||||
assert.equal(closed.receipt.outcome, 'use');
|
||||
});
|
||||
Reference in new issue
Block a user