Files
tutti/packages/agent/gui/agent-gui/agentGuiNode/model/agentGuiConversationRailViewState.spec.ts
agent-radar 2ed3415fb7
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:17:27 +08:00

62 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
AGENT_GUI_CONVERSATION_RAIL_SECTION_PAGE_SIZE,
agentGUIConversationRailScopedViewState,
agentGUIConversationRailViewScopeKey,
reduceAgentGUIConversationRailViewState
} from "./agentGuiConversationRailViewState";
describe("agent GUI conversation rail view state", () => {
it("keys durable view state by workspace and exact target", () => {
expect(
agentGUIConversationRailViewScopeKey({
conversationFilter: {
kind: "agentTarget",
agentTargetId: " local:codex "
},
workspaceId: " workspace-1 "
})
).toBe("workspace-1:agentTarget:local:codex");
expect(
agentGUIConversationRailViewScopeKey({
conversationFilter: { kind: "all" },
workspaceId: "workspace-1"
})
).toBe("workspace-1:all");
});
it("keeps collapsed sections and visible limits independent by scope", () => {
let state = reduceAgentGUIConversationRailViewState(new Map(), {
type: "section-collapsed-toggled",
scopeKey: "codex",
sectionId: "project-1"
});
state = reduceAgentGUIConversationRailViewState(state, {
type: "section-visible-limit-set",
limit: 15,
scopeKey: "codex",
sectionId: "project-1"
});
expect(
agentGUIConversationRailScopedViewState(
state,
"codex"
).collapsedSectionIds.has("project-1")
).toBe(true);
expect(
agentGUIConversationRailScopedViewState(
state,
"codex"
).visibleItemLimitBySectionId.get("project-1")
).toBe(15);
expect(
agentGUIConversationRailScopedViewState(
state,
"claude"
).visibleItemLimitBySectionId.get("project-1") ??
AGENT_GUI_CONVERSATION_RAIL_SECTION_PAGE_SIZE
).toBe(5);
});
});