Files
boss/tests/admin-skill-lifecycle-panel-source.test.ts

46 lines
1.6 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import path from "node:path";
const componentPath = path.join(
process.cwd(),
"src/components/admin/admin-skill-lifecycle-panel.tsx",
);
test("admin skill lifecycle panel exposes the requested source contract", async () => {
const source = await readFile(componentPath, "utf8");
assert.match(source, /export function AdminSkillLifecyclePanel/);
assert.match(source, /\/api\/v1\/admin\/skills\/requests/);
assert.match(source, /method:\s*"POST"/);
assert.match(source, /method:\s*"GET"/);
for (const action of ["install", "update", "uninstall", "rollback", "version_lock"]) {
assert.match(source, new RegExp(`["']${action}["']`));
}
assert.doesNotMatch(source, /@refinedev\/antd/);
});
test("admin skill lifecycle panel keeps the hifi governance summaries", async () => {
const source = await readFile(componentPath, "utf8");
assert.match(source, /最近结果/);
assert.match(source, /校验信息/);
assert.match(source, /Skill 生命周期请求与执行结果/);
assert.match(source, /adminDense/);
});
test("admin skill lifecycle panel is catalog first instead of request form first", async () => {
const source = await readFile(componentPath, "utf8");
for (const title of ["Skill 中心", "Skill 目录", "Skill 详情", "授权对象", "执行轨迹", "安装向导"]) {
assert.match(source, new RegExp(title));
}
assert.doesNotMatch(source, /title="创建 Skill 生命周期请求"/);
assert.match(source, /selectedSkill/);
assert.match(source, /activeDeviceIds/);
});