primordial-soup/test/player-symbols.test.js

17 lines
806 B
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import { PLAYER_SYMBOLS } from "@boardgamers/protocol/player-symbols";
import { colonySymbol, setPlayerSymbols } from "../viewer/art.js";
test("colony markers follow host symbols, accept live updates and restore legacy defaults", () => {
const original = colonySymbol("green");
const second = colonySymbol("red");
setPlayerSymbols(["star", "hexagon"]);
assert.ok(colonySymbol("green").includes(PLAYER_SYMBOLS.star.path));
assert.ok(colonySymbol("red").includes(PLAYER_SYMBOLS.hexagon.path));
setPlayerSymbols(["cross", "<svg>"]);
assert.ok(colonySymbol("green").includes(PLAYER_SYMBOLS.cross.path));
assert.equal(colonySymbol("red"), second);
setPlayerSymbols();
assert.equal(colonySymbol("green"), original);
});