30 lines
1.6 KiB
TypeScript
30 lines
1.6 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { MOBILE_STRONGHOLD } from '../game/board';
|
|
import { wormRideDestinationBlock as block } from '../game/worm-ride-destination';
|
|
|
|
void test('the storm at the real pointer blocks riding into the sector-zero mobile interior', () => {
|
|
for (const location of ['arsunt:11', 'arrakeen:10', 'imperial_basin:9']) {
|
|
const storm = Number(location.split(':')[1]);
|
|
const game = {storm, mobileStronghold:{location}}, before = structuredClone(game);
|
|
assert.match(block(game, MOBILE_STRONGHOLD, 0)!, /points into the storm/);
|
|
assert.deepEqual(game, before);
|
|
assert.equal(block({...game, storm:storm === 18 ? 1 : storm + 1}, MOBILE_STRONGHOLD, 0), null);
|
|
}
|
|
});
|
|
|
|
void test('ordinary territories and the Polar Sink keep their existing entry checks', () => {
|
|
const game = {storm:11, mobileStronghold:{location:'arsunt:11'}};
|
|
assert.equal(block(game, 'arsunt', 11), null);
|
|
assert.equal(block(game, 'polar_sink', 0), null);
|
|
assert.equal(block({storm:0, mobileStronghold:{location:'polar_sink:0'}}, MOBILE_STRONGHOLD, 0), null);
|
|
});
|
|
|
|
void test('an absent or malformed marker is left to the existing placement validation', () => {
|
|
assert.equal(block({storm:11}, MOBILE_STRONGHOLD, 0), null);
|
|
assert.equal(block({storm:11, mobileStronghold:null}, MOBILE_STRONGHOLD, 0), null);
|
|
assert.equal(block({storm:11, mobileStronghold:{location:null}}, MOBILE_STRONGHOLD, 0), null);
|
|
for (const location of ['missing', 'arsunt:11:extra', 'unknown:11', 'arsunt:not-a-sector'])
|
|
assert.equal(block({storm:11, mobileStronghold:{location}}, MOBILE_STRONGHOLD, 0), null);
|
|
});
|