Add per-leaf mcpAllow flag for MCP visibility gating (default-deny)
This commit is contained in:
parent
b35a5b282d
commit
6068522ee3
2 changed files with 39 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ import {
|
|||
setLeafShell,
|
||||
changeLabel,
|
||||
toggleBroadcast,
|
||||
toggleMcpAllow,
|
||||
adjustFontSize,
|
||||
adjustAllFontSizes,
|
||||
resolveFontSize,
|
||||
|
|
@ -363,6 +364,27 @@ describe("toggleBroadcast", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("toggleMcpAllow", () => {
|
||||
it("default-undefined toggles to true", () => {
|
||||
const leaf = newLeaf();
|
||||
expect(leaf.mcpAllow).toBeUndefined();
|
||||
const on = toggleMcpAllow(leaf, leaf.id) as LeafNode;
|
||||
expect(on.mcpAllow).toBe(true);
|
||||
});
|
||||
|
||||
it("true toggles to false", () => {
|
||||
const leaf = newLeaf({ mcpAllow: true });
|
||||
const off = toggleMcpAllow(leaf, leaf.id) as LeafNode;
|
||||
expect(off.mcpAllow).toBe(false);
|
||||
});
|
||||
|
||||
it("MUST NOT swap the leaf id (metadata-only, no PTY respawn)", () => {
|
||||
const leaf = newLeaf();
|
||||
const next = toggleMcpAllow(leaf, leaf.id) as LeafNode;
|
||||
expect(next.id).toBe(leaf.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveFontSize", () => {
|
||||
it("returns the default when offset is undefined or 0", () => {
|
||||
expect(resolveFontSize(undefined)).toBe(DEFAULT_FONT_SIZE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue