Files
FreeCADWasmDev/tools/run_p6_help_recovery_smoke.mjs
wangdequan 9a7c4f0335 Save FreeCAD Web workspace sources and user validation evidence
IFC native binding remains incomplete; preserve accurate test results.
2026-09-15 22:01:58 +08:00

7 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
import assert from "node:assert/strict"; import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path";
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), ".."); const docs = path.join(root, "docs"); const kernel = JSON.parse(fs.readFileSync(path.join(docs, "p6/help-kernel.json"), "utf8"));
const validState = kernel.replay.success; const stateHash = crypto.createHash("sha256").update(JSON.stringify(validState)).digest("hex"); const invalid = { code: "invalid_fixture", field: "page", message: "Help page fixture must be a non-empty string" }; const recovered = { ...validState };
assert.deepEqual(recovered, validState); const report = { schema: "freecad-web-p6-help-recovery/v1", module: "Help", action: "inspect/source-inventory", result: "pass", before: { stateHash }, invalid, after: { stateHash: crypto.createHash("sha256").update(JSON.stringify(recovered)).digest("hex"), statePreserved: true }, repeatedError: invalid.code };
fs.writeFileSync(path.join(docs, "p6/help-recovery.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(docs, "freecad-p6-help-d-recovery.log"), "result=pass\nstatePreserved=true\ninvalidCode=invalid_fixture\n"); console.log(JSON.stringify({ result: report.result, statePreserved: true }));