import assert from "node:assert/strict"; import fs from "node:fs"; const catalog = JSON.parse(fs.readFileSync(new URL("../../web/app/src/capabilities/blender-feature-route-catalog.json", import.meta.url), "utf8")); const inventory = JSON.parse(fs.readFileSync(new URL("../../tests/golden/WBV2/dynamic-inventory.json", import.meta.url), "utf8")); assert.equal(catalog.schemaVersion, 1); assert.equal(catalog.unitCount, inventory.summary.unitCount); assert.equal(catalog.classifiedCount, catalog.entries.length); assert.equal(catalog.unclassifiedCount, 0); assert.deepEqual(new Set(catalog.entries.map((entry) => entry.id)), new Set(inventory.units.map((entry) => entry.id))); assert.ok(catalog.entries.every((entry) => ["WEB_MAIN", "SERVER_NATIVE", "BROWSER_EQUIVALENT", "UNAVAILABLE"].includes(entry.route))); const browserGroups = new Set(Object.keys(catalog.browserActionGroups ?? {})); assert.ok(catalog.entries.filter((entry) => entry.route === "BROWSER_EQUIVALENT").every((entry) => browserGroups.has(entry.browserActionGroup)), "BROWSER_EQUIVALENT entries must declare an actionable browser group"); assert.equal(catalog.entries.find((entry) => entry.identifier === "WM_OT_save_auto_save")?.browserActionGroup, "AUTOSAVE"); assert.equal(catalog.browserActionGroups.AUTOSAVE.command, "saveNativeAutoSave"); assert.equal(catalog.entries.find((entry) => entry.identifier === "WM_OT_recover_auto_save")?.browserActionGroup, "RECOVERY"); assert.equal(catalog.browserActionGroups.RECOVERY.command, "recoverNativeAutoSave"); assert.equal(catalog.entries.find((entry) => entry.identifier === "WM_OT_recover_last_session")?.browserActionGroup, "LAST_SESSION"); assert.equal(catalog.browserActionGroups.LAST_SESSION.command, "recoverLastSession"); assert.ok(catalog.entries.filter((entry) => entry.route === "SERVER_NATIVE").every((entry) => entry.httpRoute === "/api/server-operator-job"), "SERVER_NATIVE entries must declare the HTTP provider route"); assert.equal(catalog.behavioralEvidence.verifiedUnits + catalog.behavioralEvidence.unverifiedUnits, catalog.unitCount); assert.equal(catalog.behavioralEvidence.verifiedUnits, 1025); process.stdout.write(`blender-feature-route-catalog-ok units=${catalog.unitCount} server=${catalog.counts.SERVER_NATIVE ?? 0} browser=${catalog.counts.BROWSER_EQUIVALENT ?? 0} verified=${catalog.behavioralEvidence.verifiedUnits} unverified=${catalog.behavioralEvidence.unverifiedUnits}\n`);