MC/website/tests/kit-ingame-contract.test.mjs
2026-11-27 23:43:05 +00:00

22 lines
1.4 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import {readFileSync} from 'node:fs';
const market=readFileSync(new URL('../control-panel/kit-market.mjs',import.meta.url),'utf8');
const studio=readFileSync(new URL('../control-panel/kit-studio.mjs',import.meta.url),'utf8');
const bridge=readFileSync(new URL('../node/kit-catalogue.mjs',import.meta.url),'utf8');
const handoff=readFileSync(new URL('../docs/KIT-EXCHANGE-INGAME-HANDOFF.md',import.meta.url),'utf8');
test('game handoff documents every CP-to-native kit route',()=>{
for(const path of ['/api/kits/catalogue','/api/kits/arc','/api/kits/orders','/api/kits/redeem','/api/kits/arc/claim','/api/kits/cart/checkout']){
assert.ok(market.includes(path),`missing gateway route ${path}`);
assert.ok(handoff.includes('`'+path+'`'),`missing documented route ${path}`);
}
for(const path of ['/api/kits/studio','/api/kits/server-studio'])assert.ok(handoff.includes('`'+path+'`'));
});
test('game handoff retains rollout gates and explicitly defers plugin changes',()=>{
for(const gate of ['kit-policy-v2-publish-enabled','kit-legendary-upgrade-delivery-ready']){
assert.ok(studio.includes(gate));assert.ok(handoff.includes(gate));
}
assert.ok(bridge.includes('kit-policy-v2-publish-enabled'));
assert.match(handoff,/Do not change, build, publish or deploy Minecraft plugins/);
assert.match(handoff,/Existing personal-sale behavior is deliberately unchanged/);
});