test(canvas): add WorkspaceNode component coverage (51 cases, closes #639) #642

Merged
hongming-pc2 merged 1 commits from fix/issue-639-workspacenode-test-coverage into staging 2026-05-12 02:33:08 +00:00

Summary

  • Add 51 test cases for WorkspaceNode component across 8 describe blocks
  • Covers: render (name, role, tier, runtime, skills, task), all 7 status states, all interaction handlers (click, shift-click, double-click, context menu, drag-over, keyboard), needs-restart banner, layout, selection/hover states, and a11y
  • Fix Zustand useSyncExternalStore mock with inline pattern; add getState() for restartWorkspace bypass; fix Position.Top/Bottom mock values; add cardButton() helper for multiple role=button elements

Test plan

  • cd canvas && npm test — WorkspaceNode: 51/51 pass
  • cd canvas && npm run build — build passes
  • Pre-existing failures (47) unchanged

🤖 Generated with Claude Code

## Summary - Add 51 test cases for `WorkspaceNode` component across 8 describe blocks - Covers: render (name, role, tier, runtime, skills, task), all 7 status states, all interaction handlers (click, shift-click, double-click, context menu, drag-over, keyboard), needs-restart banner, layout, selection/hover states, and a11y - Fix Zustand `useSyncExternalStore` mock with inline pattern; add `getState()` for `restartWorkspace` bypass; fix `Position.Top/Bottom` mock values; add `cardButton()` helper for multiple role=button elements ## Test plan - `cd canvas && npm test` — WorkspaceNode: 51/51 pass - `cd canvas && npm run build` — build passes - Pre-existing failures (47) unchanged 🤖 Generated with [Claude Code](https://claude.ai/claude-code)
fullstack-engineer added 1 commit 2026-05-12 02:27:54 +00:00
test(canvas): add WorkspaceNode component coverage (51 cases, closes #639)
All checks were successful
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 15s
sop-tier-check / tier-check (pull_request) Successful in 16s
audit-force-merge / audit (pull_request) Successful in 7s
5c23498458
51 test cases across 8 describe blocks:
- render: name, role, tier badges, runtime label, skills, active task, offline banner
- status states: online, offline, provisioning, paused, degraded, failed, not_configured
- interactions: click select, shift-click multi, double-click chat, context menu, drag-over, keyboard, needsRestart
- layout: sub badge, needsRestart banner
- selection: single, multi, hover class
- accessibility: role, tabIndex, aria-pressed, aria-label, handle labels

Fixes Zustand useSyncExternalStore mock by using inline mock pattern
(vi.fn with captured closure _storeSnap) instead of module-level const.
Adds getState() to mock for restartWorkspace which bypasses selector.
Fixes Position.Top/Bottom mock values, multi role=button ambiguity
via cardButton() helper, and online status empty-label assertion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
hongming-pc2 merged commit f6bc90bc43 into staging 2026-05-12 02:33:08 +00:00
Sign in to join this conversation.
No description provided.