agent-ecosystem/test/renderer/features/agent-graph/kanbanLayout.test.ts
777genius aed08113e6 feat(agent-graph): integrate stable slot layout for improved node positioning and interaction
- Added stable slot layout support in various components, enhancing the layout and interaction of nodes.
- Updated TypeScript configuration to include new paths for the agent-graph package.
- Refactored layout logic in activity lanes and kanban to accommodate stable slot assignments.
- Enhanced GraphView and GraphControls to support sidebar visibility toggling and owner slot drop handling.
- Introduced new types for layout management in GraphDataPort and related files.
- Updated README to include stable slot layout documentation.
2026-04-15 16:18:11 +03:00

53 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { KanbanLayoutEngine } from '../../../../packages/agent-graph/src/layout/kanbanLayout';
import type { GraphNode } from '@claude-teams/agent-graph';
function createLead(teamName: string): GraphNode {
return {
id: `lead:${teamName}`,
kind: 'lead',
label: `${teamName}-lead`,
state: 'active',
x: 0,
y: 0,
domainRef: { kind: 'lead', teamName, memberName: 'lead' },
};
}
function createTask(teamName: string, taskId: string, ownerId?: string | null): GraphNode {
return {
id: `task:${taskId}`,
kind: 'task',
label: `#${taskId}`,
displayId: `#${taskId}`,
state: 'idle',
ownerId: ownerId ?? null,
taskStatus: 'pending',
domainRef: { kind: 'task', teamName, taskId },
};
}
describe('KanbanLayoutEngine', () => {
it('routes tasks with missing owners into the unassigned lane', () => {
const teamName = 'team-kanban';
const lead = createLead(teamName);
const orphanTask = createTask(teamName, 'task-orphan', 'member:team-kanban:agent-missing');
KanbanLayoutEngine.layout([lead, orphanTask], {
unassignedTaskRect: {
left: -80,
top: 120,
right: 80,
bottom: 540,
width: 160,
height: 420,
},
});
expect(orphanTask.x).toBe(0);
expect(orphanTask.y).toBe(120);
expect(KanbanLayoutEngine.zones.some((zone) => zone.ownerId === '__unassigned__')).toBe(true);
});
});