forked from molecule-ai/molecule-core
[Molecule-Platform-Evolvement-Manager] Closes the second item from #2071 (Canvas test gaps follow-up): adds behavioural coverage for the custom React Flow edge that renders delegation counts between workspaces and routes a click into the source workspace's Activity feed. 10 cases across 2 buckets: **Render (6):** - Empty label → BaseEdge only, NO portaled HTML pill (the most common state for cold edges; pill must not render-through-empty) - Non-empty label → pill renders with the exact label text - isHot=true → violet accent classes; blue accent NOT present - isHot=false → blue accent classes - ARIA pluralization: count=1 → "1 delegation from …" (singular) - ARIA pluralization: count=7 → "7 delegations from …" (plural) **Click behaviour (4):** - Click → selectNode(source) - FRESH selection (selectedNodeId != source) → also setPanelTab("activity") - RE-click of already-selected source → setPanelTab MUST NOT fire (this is the regression-locked guarantee — preserves the user's current tab when they intentionally moved to Chat / Memory while inspecting the same peer) - stopPropagation: parent onClick must NOT see the event (otherwise the canvas Pane's clear-selection handler would fire and undo the edge's own selectNode call) ## Mocking strategy - `@xyflow/react`: BaseEdge → <g data-testid>, EdgeLabelRenderer → inline pass-through (no portal), getBezierPath → fixed [path, x, y]. Lets the test render the component without a ReactFlow provider. - `@/store/canvas`: vi.hoisted-shared mock state with selectNode + setPanelTab spies and a mutable selectedNodeId. The store's getState() returns the same object so the click handler's `useCanvasStore.getState().selectedNodeId` lookup works. Pattern matches the existing `A2ATopologyOverlay.test.tsx` setup in the same module. ## Test plan - [x] All 10 cases pass locally (`vitest run A2AEdge.test.tsx` — ~1.3s) - [x] No changes to the SUT — pure additive coverage - [ ] CI green ## Remaining #2071 items - OrgCancelButton tests - useDragHandlers tests Each is a separate PR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| e2e | ||
| public | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| components.json | ||
| Dockerfile | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| playwright.config.ts | ||
| playwright.staging.config.ts | ||
| postcss.config.js | ||
| tailwind.config.ts | ||
| tsconfig.json | ||
| vitest.config.ts | ||