Each player summary opens enlarged original counter diagrams and public physical pools. The inventory separates reserves, Tanks, board locations and foreign Homeworld deployments. Native Homeworlds break down existing reserves; elites and advisor stances remain subsets. The reference gallery covers all twelve factions, including Suboids/Cyborgs, Sardaukar, Fedaykin and BG advisor faces. Actual force keys retain unplaced Mobile Stronghold and Discovery groups. Basic Homeworld special identity comes from public typed pools, not mode alone. Concealed No-Fields expose only a separate marker/location; no value or future materialization is inferred. Temporary battle strength creates no physical counter. Invalid projections show a refresh notice instead of invented totals. Inspection updates from current props and submits no action or saved mutation. Independent review found no material issue and clarified No-Field wording: revelation draws from reserves available then, without earmarking counters. Eleven new focused cases cover faction identity, typed pools, advisors, genuine Basic Homeworld public views, native/foreign splits, genuine Ix setup before HMS placement, a controlled Discovery position, JSON continuation, input immutability, concealed0/3/5 equivalence, named controls and malformed projection feedback. A test-only Homeworld projection initially omitted its card identity; corrected before final checks. Lint's semantic status element was corrected to output. Types, lint, all 4984 offline tests and production build passed on stable source. No HTTP/auth/schema/persistence behavior changed, so no additional HTTP suite was required. Browser QA reused an isolated existing three-human Basic Nexus without game actions. All three public inspectors showed correct pools; Escape restored trigger focus, Enter opened inspection and PageDown scrolled the labelled region. At390px the dialog359px fit, body text16px and Close44px high. All twelve gallery choices rendered named160px diagrams without gallery overflow. Internal guide, Back and refresh worked; viewport reset and preview retained. Screenshot capture timed out. Full visual/screen-reader/200% zoom, manufactured component fidelity and all-configuration browser acceptance remain open. All 1499 original rooms, 3171 seats and auxiliary rows are unchanged; SQLite integrity and foreign keys pass. The healthy server was reused without restart, migration, reset or automation. AI strategy/calibration remains deferred until non-AI features are complete; no mode/publication gate was opened. Private evidence: 20260921-force-inspection. Verified source tree: 5d7ffd471229faa13224fd5a87d33c3ac5af866446241a7881926a54c1ee49eb
63 lines
3.8 KiB
TypeScript
63 lines
3.8 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { readFileSync } from 'node:fs';
|
|
import { registerHooks } from 'node:module';
|
|
import { createElement } from 'react';
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { FACTIONS } from '../game/catalog';
|
|
import { createGame, joinGame, newPlayer, viewGame } from '../game/engine';
|
|
import { createRicheseNoField, deployRicheseNoField, projectRicheseNoField } from '../game/richese-no-field';
|
|
|
|
const aliases=registerHooks({
|
|
resolve(specifier,context,next) { return next(specifier==='next/link'?'vinext/shims/link':specifier==='next/image'?'vinext/shims/image':specifier,context); },
|
|
load(url,context,next) {
|
|
if(!url.endsWith('.module.css')) return next(url,context);
|
|
const css=readFileSync(new URL(url),'utf8');
|
|
const classes=Object.fromEntries([...css.matchAll(/\.([a-zA-Z_][\w-]*)/g)].map(m=>[m[1],m[1]]));
|
|
return {format:'module',source:`export default ${JSON.stringify(classes)}`,shortCircuit:true};
|
|
},
|
|
});
|
|
const { ForceCounterFace, ForceInventoryDetails, ForceReferenceGallery }=await import('../components/force-inspector');
|
|
const { GameTable }=await import('../components/game-table');
|
|
aliases.deregister();
|
|
|
|
void test('live player summaries expose named inspection to every seat without sending an action', () => {
|
|
const g=createGame('FORCEUI',newPlayer('a','A observer','atreides'));
|
|
joinGame(g,newPlayer('h','H observer','harkonnen'));
|
|
const before=JSON.stringify(g);
|
|
const html=renderToStaticMarkup(createElement(GameTable,{game:viewGame(g,'a'),send:async()=>{assert.fail('Inspection must not act.');},onExit(){},busy:true}));
|
|
assert.match(html,/Inspect forces: A observer · Atreides/);
|
|
assert.match(html,/Inspect forces: H observer · Harkonnen/);
|
|
assert.equal((html.match(/>Inspect forces</g)??[]).length,2);
|
|
assert.equal(JSON.stringify(g),before);
|
|
});
|
|
|
|
void test('reference covers every faction and renders enlarged ordinary, special and advisor identities', () => {
|
|
const html=renderToStaticMarkup(createElement(ForceReferenceGallery));
|
|
for(const house of FACTIONS) {
|
|
assert.ok(html.includes(`value="${house.id}"`));
|
|
const face=renderToStaticMarkup(createElement(ForceCounterFace,{factionId:house.id,kind:'force'}));
|
|
assert.ok(face.includes(`${house.name} `));
|
|
}
|
|
for(const [id,name] of [['emperor','Sardaukar'],['fremen','Fedaykin'],['ixians','Cyborg']] as const)
|
|
assert.match(renderToStaticMarkup(createElement(ForceCounterFace,{factionId:id,kind:'special'})),new RegExp(name));
|
|
assert.match(renderToStaticMarkup(createElement(ForceCounterFace,{factionId:'beneGesserit',kind:'advisor'})),/Advisor counter/);
|
|
});
|
|
|
|
void test('visible counter details preserve concealed-value privacy and render invalid pools without invented counts', () => {
|
|
const bodies=[];
|
|
for(const value of [0,3,5] as const) {
|
|
const state=createRicheseNoField(['hidden-zero','hidden-three','hidden-five']);
|
|
const deployed=deployRicheseNoField(state,{tokenId:state.tokens.find(t=>t.value===value)!.id,controller:'r',location:{territory:'arrakeen',sector:10}});
|
|
const player={...newPlayer('r','Richese','richese'),noField:projectRicheseNoField(deployed,false)};
|
|
const html=renderToStaticMarkup(createElement(ForceInventoryDetails,{player}));
|
|
assert.match(html,/20 physical force counters/);assert.match(html,/Concealed No-Field/);
|
|
assert.match(html,/Arrakeen · sector 10/);assert.doesNotMatch(html,/hidden-zero|hidden-three|hidden-five/);
|
|
bodies.push(html);
|
|
}
|
|
assert.equal(bodies[0],bodies[1]);assert.equal(bodies[1],bodies[2]);
|
|
const invalid={...newPlayer('i','Ixians','ixians'),reserves:1};
|
|
const html=renderToStaticMarkup(createElement(ForceInventoryDetails,{player:invalid}));
|
|
assert.match(html,/<output/);assert.match(html,/could not be reconciled/);assert.doesNotMatch(html,/physical force counters/);
|
|
});
|