test: cover master agent evolution entry wiring

This commit is contained in:
kris
2026-04-16 06:02:27 +08:00
parent 363f732e29
commit 4bedf75dc2
2 changed files with 65 additions and 0 deletions

View File

@@ -52,3 +52,21 @@ test("me page exposes master agent evolution entry", async () => {
assert.match(source, /href="\/me\/master-agent\/evolution"/, "expected me page to link evolution page");
assert.match(source, /title="主 Agent 自动进化"/, "expected me page to show evolution menu title");
});
test("master agent evolution page renders admin-aware dashboard shell", async () => {
const pageSource = await readSource("src/app/me/master-agent/evolution/page.tsx");
const clientSource = await readSource("src/components/master-agent-evolution-client.tsx");
assert.match(pageSource, /getMasterAgentEvolutionDashboard/, "expected page to load evolution dashboard server-side");
assert.match(pageSource, /session\.role === "highest_admin"/, "expected page to gate admin actions by role");
assert.match(pageSource, /<MasterAgentEvolutionClient/, "expected page to render evolution client");
assert.match(clientSource, /待处理提案/, "expected dashboard to expose pending proposals");
assert.match(clientSource, /最近信号/, "expected dashboard to expose recent signals");
assert.match(clientSource, /已生效规则/, "expected dashboard to expose applied rules");
assert.match(clientSource, /\/api\/v1\/master-agent\/evolution\/config/, "expected mode switch API to be wired");
assert.match(
clientSource,
/\/api\/v1\/master-agent\/evolution\/proposals\/\$\{proposalId\}\/\$\{action\}/,
"expected proposal review API to be wired",
);
});