Support scheduled travel agreements
Verify and publish checkpoint container / container (push) Successful in 11m8s
Verify and publish checkpoint container / container (push) Successful in 11m8s
This commit is contained in:
1 parent
e1e02fc1a1
commit
1e81ce8ad8
13 files changed
+767
-56
No files matched your search
@@ -10,7 +10,7 @@ import { nextStrongholdFactionsNativeStep as next } from './fixture-stronghold-f
|
||||
const proposer = 'atreides', traveler = 'emperor', first = 'harkonnen', second = 'fremen';
|
||||
const shipment: Action = {type:'ship', territory:'polar_sink', sector:0, amount:1, elite:0, allyPayment:0};
|
||||
const movement: Action = {type:'move', from:'polar_sink:0', territory:'imperial_basin', sector:9, amount:1};
|
||||
type Term = {actor:string; kind:'ship'|'move'; territory:string; minimum:number; answer:boolean};
|
||||
type Term = {actor:string; kind:'ship'|'move'; territory:string; minimum:number; answer:boolean; dueTurn?:number};
|
||||
|
||||
function reach(game: Game, until: (game: Game) => boolean): Game {
|
||||
for (let count = 0; count < 1200; count++) {
|
||||
@@ -120,6 +120,34 @@ void test('four-party consent requires all other recipients first and release re
|
||||
assert.equal(status(game, first, offered.id), 'released');
|
||||
});
|
||||
|
||||
void test('a four-party future shipment stays scheduled until the due turn and follows the named traveler', () => {
|
||||
const initial = fixture(), dueTurn = initial.turn + 1, originalCards = inventory(initial);
|
||||
const offered = offer(initial, [first, traveler, second],
|
||||
{actor:traveler, kind:'ship', territory:'polar_sink', minimum:1, answer:true, dueTurn});
|
||||
let game = offered.game;
|
||||
reject(game, traveler, {type:'dealRespond', deal:offered.id, accept:true});
|
||||
game = respond(game, second, offered.id);
|
||||
reject(game, traveler, {type:'dealRespond', deal:offered.id, accept:true});
|
||||
game = respond(game, first, offered.id);
|
||||
game = respond(game, traveler, offered.id);
|
||||
assert.equal(game.deals!.at(-1)!.status, 'active');
|
||||
assert.equal(receipt(game, offered.id).player, traveler);
|
||||
assert.equal(receipt(game, offered.id).turn, dueTurn);
|
||||
for (const viewer of [proposer, first, second, traveler])
|
||||
assert.equal(status(game, viewer, offered.id), 'scheduled');
|
||||
assert.equal(viewGame(game, traveler).travelPromiseGuide ?? null, null);
|
||||
game = settle(act(game, traveler, {type:'endMovement'}));
|
||||
game = reach(game, state => state.turn === dueTurn && state.phase === 5 &&
|
||||
state.active === traveler && clean(state) && !state.pendingShipment);
|
||||
assert.equal(status(game, traveler, offered.id), 'pending');
|
||||
reject(game, traveler, {type:'endMovement'});
|
||||
game = settle(act(game, traveler, shipment));
|
||||
for (const viewer of [proposer, first, second, traveler])
|
||||
assert.equal(status(game, viewer, offered.id), 'fulfilled');
|
||||
assert.equal(player(game, traveler).forces['polar_sink:0'], 1);
|
||||
assert.deepEqual(inventory(game), originalCards);
|
||||
});
|
||||
|
||||
for (const answer of [true, false]) void test(`group movement ${answer ? 'requires' : 'forbids'} one real matching action`, () => {
|
||||
const moved = settle(act(fixture(), traveler, shipment));
|
||||
const offered = offer(moved, [first, traveler],
|
||||
|
||||
Reference in new issue
Block a user