Add optional short alliance victory
Verify and publish checkpoint container / container (push) Successful in 11m2s
Verify and publish checkpoint container / container (push) Successful in 11m2s
This commit is contained in:
1 parent
8fb9f59106
commit
e896570f07
25 files changed
+632
-27
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { allianceVictoryTarget } from '../game/alliance-victory-option';
|
||||
import type { TwoPlayerControllers } from '../game/two-player-controllers';
|
||||
|
||||
const seats = ['atreides', 'harkonnen', 'fremen', 'guild', 'emperor', 'beneGesserit'];
|
||||
const twoPeople: TwoPlayerControllers = {
|
||||
version: 1,
|
||||
controllers: [
|
||||
{ id: 'atreides', seats: ['atreides', 'harkonnen'] },
|
||||
{ id: 'fremen', seats: ['fremen', 'guild'] },
|
||||
],
|
||||
};
|
||||
|
||||
void test('existing solo and alliance targets remain unchanged unless the option is selected', () => {
|
||||
for (let count = 3; count <= 6; count++) {
|
||||
const players = seats.slice(0, count);
|
||||
assert.equal(allianceVictoryTarget(players, undefined, false), 3);
|
||||
assert.equal(allianceVictoryTarget(players, undefined, true), 4);
|
||||
assert.equal(allianceVictoryTarget(players, null, true, false), 4);
|
||||
assert.equal(allianceVictoryTarget(players, undefined, false, true), 3);
|
||||
assert.equal(allianceVictoryTarget(players, undefined, true, true), 3);
|
||||
}
|
||||
});
|
||||
|
||||
void test('two physical controllers retain four strongholds with either setup', () => {
|
||||
const before = structuredClone(twoPeople);
|
||||
assert.equal(allianceVictoryTarget(seats.slice(0, 2), undefined, false, true), 4);
|
||||
assert.equal(allianceVictoryTarget(seats.slice(0, 2), undefined, true, true), 4);
|
||||
assert.equal(allianceVictoryTarget(seats.slice(0, 4), twoPeople, false, true), 4);
|
||||
assert.equal(allianceVictoryTarget(seats.slice(0, 4), twoPeople, true, true), 4);
|
||||
assert.deepEqual(twoPeople, before);
|
||||
});
|
||||
|
||||
void test('invalid selection, side and controller mappings cannot change the target', () => {
|
||||
assert.throws(() => allianceVictoryTarget(seats.slice(0, 3), undefined, true, null as unknown as boolean), TypeError);
|
||||
assert.throws(() => allianceVictoryTarget(seats.slice(0, 3), undefined, true, 'yes' as unknown as boolean), TypeError);
|
||||
assert.throws(() => allianceVictoryTarget(seats.slice(0, 3), undefined, 'yes' as unknown as boolean, true));
|
||||
assert.throws(() => allianceVictoryTarget(['same', 'same', 'third'], undefined, true, true));
|
||||
assert.throws(() => allianceVictoryTarget(seats.slice(0, 3), twoPeople, true, true));
|
||||
});
|
||||
Reference in new issue
Block a user