feat: 编辑框合并说明/用途字段,编辑模式下允许修改说明
build-and-deploy / build-and-deploy (push) Successful in 42s

This commit is contained in:
cheney
2026-09-17 10:37:07 +08:00
parent 6bbd4bc471
commit 26957bcb49
5 changed files with 54 additions and 29 deletions
+32
View File
@@ -128,6 +128,38 @@ test("readonly 模式下拒绝项目/配置写操作,切换回 edit 后恢复"
await callTool("set_mode", { mode: "edit" });
});
test("edit 模式下可以修改配置说明", async () => {
await callTool("set_mode", { mode: "edit" });
const { text: createText } = await callTool("create_project", { name: "MCP-Unittest-Desc" });
const project = JSON.parse(createText.match(/\{[\s\S]*\}/)[0]);
const cfg = await callTool("create_config", {
projectId: project.id,
key: "db/host",
description: "原始说明",
value: "localhost",
});
const cfgObj = JSON.parse(cfg.text.match(/\{[\s\S]*\}/)[0]);
const updated = await callTool("update_config", {
projectId: project.id,
configId: cfgObj.id,
description: "新的说明",
});
assert.ok(!updated.isError, "edit 模式下应允许修改说明");
const updatedObj = JSON.parse(updated.text.match(/\{[\s\S]*\}/)[0]);
assert.strictEqual(updatedObj.description, "新的说明");
assert.strictEqual(updatedObj.value, "localhost", "仅改说明,值不应变化");
// 清理测试项目
const delProject = await callTool("delete_project", { projectId: project.id });
const confirmProject = await callTool("confirm_delete_project", {
confirmation_token: delProject.structuredContent.confirmation_token,
});
assert.strictEqual(confirmProject.structuredContent.status, "deleted");
});
test("配置删除同样为两步式确认", async () => {
const { text: createText } = await callTool("create_project", { name: "MCP-Unittest-Cfg" });
const project = JSON.parse(createText.match(/\{[\s\S]*\}/)[0]);