import test from 'node:test'; import assert from 'node:assert/strict'; import {describeRedemption} from '../control-panel/public/cp-v2/cp-v2-code-redemption.mjs'; test('existing deliverable codes describe their real route',()=>{ assert.equal(describeRedemption(' drk-'+ 'a'.repeat(32)+' ').kind,'kit'); assert.equal(describeRedemption('DRQ-'+ 'A'.repeat(40)).available,true); assert.equal(describeRedemption('DRU-'+ 'A'.repeat(48)).href,'#realm/kits-exchange'); }); test('founding and political previews do not claim working redemption or royal status',()=>{ for(const prefix of ['CLAN','COM','POL'])assert.equal(describeRedemption(prefix+'-'+ 'A'.repeat(48)).available,false); assert.match(describeRedemption('CLAN-'+ 'A'.repeat(48)).description,/separate political appointment/); assert.match(describeRedemption('POL-'+ 'A'.repeat(48)).description,/recorded by a political decision/); }); test('partial, malformed and unsupported codes cannot advance to confirmation',()=>{ for(const code of ['', 'CLAN-123', 'DRK-'+ '0'.repeat(32), '/communitycode test','