import test from 'node:test';import assert from 'node:assert/strict'; import {starterKitSnapshot,starterIdentity} from '../node/starter-kit-native-design.mjs'; import {intactStarterSnapshot} from '../node/starter-kit-events.mjs'; import {kitsetDeliveryItems} from '../node/kitset-grants.mjs'; import {defaultKitEquipment} from '../control-panel/public/kit-design-model.mjs'; test('every House uses the shared T0 armour and wooden spice shovel definitions',()=>{ const identities=new Set();for(const faction of ['atreides','harkonnen','corrino','ordos','fremen']){ const snapshot=intactStarterSnapshot(starterKitSnapshot(faction)),items=kitsetDeliveryItems(snapshot.kitset);assert.equal(items.length,5); assert.equal(items.filter(i=>i.design.equipmentMark===0&&i.design.quality==='common').length,4);assert.equal(items[4].template.material,'wooden_shovel');assert.equal(items[4].design.equipmentMark,1);assert.equal(items[4].design.quality,'uncommon'); assert.deepEqual(intactStarterSnapshot(snapshot),snapshot);identities.add(starterIdentity(faction)); }assert.equal(identities.size,5); }); test('starter snapshots cannot smuggle a higher grade, another owner, extra items or duplicate equipment',()=>{ for(const change of [s=>s.kitset.items[0].design.equipmentMark=14,s=>s.kitset.items.push(structuredClone(s.kitset.items[0])),s=>s.kitset.items[0].quantity=2,s=>s.kitset.owner={kind:'clan',id:'owned'},s=>s.command='give @a diamond']){const s=starterKitSnapshot('atreides');change(s);assert.throws(()=>intactStarterSnapshot(s));} }); test('existing legacy starter evidence keeps its original immutable snapshot format',()=>{ const legacy={name:'Original kit',quality:'common',commerceKind:'faction_sale',color:'#336633',lore:[],equipment:defaultKitEquipment()};assert.deepEqual(intactStarterSnapshot(legacy),legacy);assert.throws(()=>starterKitSnapshot('unknown')); });