推进 INI 面板 entry docs strict gate
This commit is contained in:
@@ -9,6 +9,8 @@ control view:
|
||||
|
||||
```js
|
||||
import {
|
||||
INI_PANEL_ENTRIES,
|
||||
getIniPanelEntryByHref,
|
||||
getIniPanelEntryManifest,
|
||||
createMachineSessionControlPageController,
|
||||
renderMachineSessionControlView,
|
||||
|
||||
@@ -4,21 +4,43 @@ import { fileURLToPath } from "node:url";
|
||||
import { dirname, resolve } from "node:path";
|
||||
|
||||
import {
|
||||
INI_PANEL_ENTRIES,
|
||||
getIniPanelEntryManifest,
|
||||
} from "../../../runtime/ui/ini-panel/ui-shell.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = resolve(__dirname, "../../..");
|
||||
const docText = readFileSync(resolve(root, "docs/panel-entry.md"), "utf8");
|
||||
const shellText = readFileSync(resolve(root, "runtime/ui/ini-panel/ui-shell.js"), "utf8");
|
||||
|
||||
assert.match(docText, /runtime\/ui\/ini-panel\/ui-shell\.js/);
|
||||
assert.match(docText, /createMachineSessionControlPageController/);
|
||||
assert.match(docText, /renderMachineSessionControlView/);
|
||||
assert.match(docText, /runtime\/ui\/ini-panel\/launch\.html/);
|
||||
assert.match(docText, /runtime\/ui\/ini-panel\/control-page\.html/);
|
||||
const requiredShellExports = [
|
||||
"INI_PANEL_ENTRIES",
|
||||
"getIniPanelEntryByHref",
|
||||
"getIniPanelEntryManifest",
|
||||
"createMachineSessionControlPageController",
|
||||
"renderMachineSessionControlView",
|
||||
];
|
||||
|
||||
for (const entry of getIniPanelEntryManifest()) {
|
||||
assert.match(docText, new RegExp(`\\| \`${entry.id}\` \\| \`${entry.href.replace(".", "\\.")}\` \\| ${entry.title} \\|`));
|
||||
for (const exportName of requiredShellExports) {
|
||||
assert.match(shellText, new RegExp(`\\b${exportName}\\b`));
|
||||
assert.match(docText, new RegExp(`\\b${exportName}\\b`));
|
||||
}
|
||||
|
||||
const requiredPages = [
|
||||
["Launch", "runtime/ui/ini-panel/launch.html"],
|
||||
["Edit and run", "runtime/ui/ini-panel/index.html"],
|
||||
["Read-only control view", "runtime/ui/ini-panel/control-page.html"],
|
||||
];
|
||||
|
||||
for (const [label, path] of requiredPages) {
|
||||
assert.match(docText, new RegExp(`\\| ${label} \\| \`${path.replaceAll("/", "\\/")}\``));
|
||||
}
|
||||
|
||||
assert.deepEqual(getIniPanelEntryManifest(), INI_PANEL_ENTRIES);
|
||||
|
||||
for (const entry of INI_PANEL_ENTRIES) {
|
||||
const escapedHref = entry.href.replace(".", "\\.");
|
||||
assert.match(docText, new RegExp(`\\| \`${entry.id}\` \\| \`${escapedHref}\` \\| ${entry.title} \\|`));
|
||||
}
|
||||
|
||||
console.log("ini_panel_entry_docs_node_smoke=ok");
|
||||
|
||||
Reference in New Issue
Block a user