forked from unimatrix/web
feat(clans): issue lifetime founding keys and connect private key redemption
This commit is contained in:
parent
6c2ef1d043
commit
bfc4a0636c
1 changed files with 295 additions and 126 deletions
|
|
@ -1,17 +1,18 @@
|
|||
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','<script>','POL-'+ 'A'.repeat(47)])assert.throws(()=>describeRedemption(code));
|
||||
});
|
||||
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('clan upgrades are available while company and political decisions retain their own routes',()=>{
|
||||
assert.equal(describeRedemption('CLAN-'+ 'A'.repeat(48)).available,true);
|
||||
for(const prefix of ['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','<script>','POL-'+ 'A'.repeat(47)])assert.throws(()=>describeRedemption(code));
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff