import test from 'node:test'; import assert from 'node:assert/strict'; import {readFileSync,readdirSync} from 'node:fs'; import {createHash} from 'node:crypto'; import {recipeCatalogue,recipeIcons} from '../scripts/recipe-catalogue.mjs'; import {MAIN_MENU_GROUPS} from '../scripts/main-menu.mjs'; import {PORTAL_NAV} from '../scripts/portal-navigation.mjs'; import {SHARED_FOOTER} from '../scripts/site-chrome.mjs'; test('website-only inputs preserve all 32 published recipes and their exact icon bytes',()=>{ const baseline=JSON.parse(readFileSync(new URL('./fixtures/cookbook-before-repository-split.json',import.meta.url))); const hash=bytes=>createHash('sha256').update(bytes).digest('hex'),recipes=recipeCatalogue(); assert.equal(recipes.length,baseline.recipes);assert.equal(hash(JSON.stringify(recipes)),baseline.catalogueSha256); assert.deepEqual(Object.fromEntries(recipeIcons(recipes).map(([name,bytes])=>[name,hash(bytes)])),baseline.icons); }); test('shared menus expose the existing DuneForge workspace and root DuneGit register',()=>{ assert(MAIN_MENU_GROUPS['My Account'].some(([name,url])=>name==='DuneForge'&&url==='https://cp.dunerealms.com/#forge/git-workspace')); assert(PORTAL_NAV.includes('https://cp.dunerealms.com/#forge/git-workspace')); assert(SHARED_FOOTER.includes('href="https://www.dunerealms.com/git/"')); }); test('the web repository contains no active plugin, server or resource-pack source trees',()=>{ const root=new URL('../../',import.meta.url),names=readdirSync(root); for(const name of ['DuneEss','DuneLobby','DuneMenus','DuneNPC','DuneRealms-minecraft-only','DuneTerrain','JarvisConnector','DuneResourcePack','DuneResourcePack.zip','network','worlds','gui-common','control-panel-inventory','.github'])assert(!names.includes(name),name+' belongs in the plugins repository'); assert.deepEqual(readdirSync(new URL('../../tools/',import.meta.url)),['README.md']); const workflows=readdirSync(new URL('../../.forgejo/workflows/',import.meta.url)); assert.deepEqual(workflows.sort(),['clean-ci-artifacts.yml','web-deploy.yml']); });