Files
mnote/scripts/task127-rust-web-mindmap-kernel-projection-smoke.js

26 lines
938 B
JavaScript

#!/usr/bin/env node
"use strict";
const assert = require("node:assert");
const BASE_URL = (process.env.MNOTE_UI_BASE_URL || "http://127.0.0.1:3000").replace(/\/$/, "");
async function main() {
const response = await fetch(`${BASE_URL}/mindmap/doc_1/mind_1`);
const html = await response.text();
assert.equal(response.status, 200, `/mindmap 请求失败: ${response.status} ${html.slice(0, 200)}`);
assert.equal(response.headers.get("x-mnote-web-shell"), "mindmap");
assert.match(html, /mnote\.mindmap_shell\.v1/);
assert.match(html, /mindmap\.projection\.get/);
assert.match(html, /mindmap\.command\.apply/);
assert.match(html, /rust-kernel/);
assert.doesNotMatch(html, /next-app-router/);
console.log(JSON.stringify({ ok: true, projectionOwner: "rust-kernel" }, null, 2));
}
main().catch((error) => {
console.error(error instanceof Error ? error.stack || error.message : String(error));
process.exit(1);
});