@@ -21,53 +21,56 @@ Add tests when actively working on these files. Each tier reflects impact and te
2121
2222These modules carry the highest risk. Test in the same PR when modifying.
2323
24+ <!-- prettier-ignore -->
2425| File | Key exports to test | Status |
25- | ------ | ------------------- | -------- |
26+ | --- | --- | --- |
2627| ` src/core/validation/ ` | ` validateFlow ` , ` validateNode ` — empty flows, missing/multiple starts, disconnected nodes, cycles, required inputs | ✅ Done |
27- | ` src/core/utils/ ` | ` getUniqueNodeId ` , ` getUniqueNodeLabel ` , ` initializeDefaultNodeData ` , ` initNode ` , ` generateExportFlowData ` , ` isValidConnectionAgentflowV2 ` | ✅ Done |
28+ | ` src/core/utils/ ` | ` getUniqueNodeId ` , ` getUniqueNodeLabel ` , ` initNode ` , ` generateExportFlowData ` , ` isValidConnectionAgentflowV2 ` | ✅ Done |
2829| ` src/core/node-catalog/ ` | ` filterNodesByComponents ` , ` isAgentflowNode ` , ` groupNodesByCategory ` | ✅ Done |
2930| ` src/core/node-config/ ` | ` getAgentflowIcon ` , ` getNodeColor ` | ✅ Done |
30- | ` src/core/theme/tokens.ts ` | All design tokens — node colors (15 types, uniqueness), light/dark variants (backgrounds, borders, text), spacing scale (8px base) , semantic colors, ReactFlow colors, shadows, border radius, gradients | ✅ Done |
31- | ` src/core/theme/cssVariables.ts ` | ` generateCSSVariables() ` — generates valid CSS strings, includes all variables (colors, spacing, shadows, etc.), correct light/dark mode values, proper formatting (px suffixes) , consistency with tokens | ✅ Done |
32- | ` src/core/theme/createAgentflowTheme.ts ` | ` createAgentflowTheme() ` — MUI theme creation, palette mode (light/dark), background/text/border colors from tokens, custom card palette extension, 8px spacing, border radius, theme consistency | ✅ Done |
31+ | ` src/core/theme/tokens.ts ` | All design tokens — node colors, light/dark variants, spacing scale, semantic colors, ReactFlow colors, shadows, border radius, gradients | ✅ Done |
32+ | ` src/core/theme/cssVariables.ts ` | ` generateCSSVariables() ` — valid CSS strings, all variables, correct light/dark values, proper formatting, consistency with tokens | ✅ Done |
33+ | ` src/core/theme/createAgentflowTheme.ts ` | ` createAgentflowTheme() ` — MUI theme creation, palette mode, colors from tokens, custom card palette, spacing, border radius, consistency | ✅ Done |
3334| ` src/infrastructure/api/client.ts ` | ` createApiClient ` — headers, auth token, 401 interceptor | ✅ Done |
3435| ` src/infrastructure/api/chatflows.ts ` | All CRUD + ` generateAgentflow ` + ` getChatModels ` , FlowData serialization | ✅ Done |
3536| ` src/infrastructure/api/nodes.ts ` | ` getAllNodes ` , ` getNodeByName ` , ` getNodeIconUrl ` | ✅ Done |
36- | ` src/infrastructure/store/AgentflowContext.tsx ` | ` agentflowReducer ` (all action types ), ` normalizeNodes ` . Remaining: ` deleteNode() ` , ` duplicateNode() ` , ` updateNodeData() ` , ` getFlowData() ` — React callbacks, test when provider stabilizes | 🟡 Partial |
37- | ` src/useAgentflow.ts ` | ` getFlow() ` , ` toJSON() ` , ` validate() ` , ` addNode() ` , ` clear() ` | ⬜ Not yet — thin wrapper, test when hook gains own logic |
38- | ` src/features/canvas/hooks/useFlowHandlers.ts ` | ` onConnect ` , ` onNodesChange ` , ` onEdgesChange ` , ` onAddNode ` | ⬜ Not yet — heavily coupled to ReactFlow, test when handlers stabilize |
37+ | ` src/infrastructure/store/AgentflowContext.tsx ` | ` agentflowReducer ` (all actions ), ` normalizeNodes ` . Remaining: ` deleteNode() ` , ` duplicateNode() ` , ` updateNodeData() ` , ` getFlowData() ` | 🟡 Partial |
38+ | ` src/useAgentflow.ts ` | ` getFlow() ` , ` toJSON() ` , ` validate() ` , ` addNode() ` , ` clear() ` | ⬜ Not yet — thin wrapper |
39+ | ` src/features/canvas/hooks/useFlowHandlers.ts ` | ` onConnect ` , ` onNodesChange ` , ` onEdgesChange ` , ` onAddNode ` | ⬜ Not yet — coupled to ReactFlow |
3940
4041### Tier 2 — Feature Hooks & Dialogs
4142
4243Test when adding features or fixing bugs in these areas.
4344
45+ <!-- prettier-ignore -->
4446| File | Key exports to test | Status |
45- | ------ | ------------------- | -------- |
47+ | --- | --- | --- |
4648| ` src/features/node-palette/search.ts ` | ` fuzzyScore ` , ` searchNodes ` , ` debounce ` | ✅ Done |
4749| ` src/features/canvas/hooks/useFlowNodes.ts ` | ` useFlowNodes() ` — category filtering, component whitelist, error states | ⬜ Not yet |
4850| ` src/features/canvas/hooks/useDragAndDrop.ts ` | ` useDragAndDrop() ` — JSON parse error handling, node init on drop | ⬜ Not yet |
4951| ` src/features/canvas/hooks/useNodeColors.ts ` | ` useNodeColors() ` — color calculations for selected/hover/dark mode | ⬜ Not yet |
5052| ` src/infrastructure/store/ConfigContext.tsx ` | ` ConfigProvider ` — theme detection (light/dark/system), media query listener | ⬜ Not yet |
5153| ` src/features/generator/GenerateFlowDialog.tsx ` | Dialog state machine — API call flow, error handling, progress state | ⬜ Not yet |
5254| ` src/features/node-editor/EditNodeDialog.tsx ` | Label editing — keyboard handling (Enter/Escape), node data updates | ⬜ Not yet |
53- | ` src/infrastructure/api/hooks/useApi.ts ` | ` useApi() ` — loading/error/data state transitions | ⬜ Not yet — may be deprecated, check before investing |
55+ | ` src/infrastructure/api/hooks/useApi.ts ` | ` useApi() ` — loading/error/data state transitions | ⬜ Not yet — may be deprecated |
5456
5557### Tier 3 — UI Components
5658
5759Mostly JSX with minimal logic. Only add tests if business logic is introduced.
5860
61+ <!-- prettier-ignore -->
5962| File | When to add tests | Status |
60- | ------ | ------------------ | -------- |
63+ | --- | --- | --- |
6164| ` src/features/node-palette/AddNodesDrawer.tsx ` | If category grouping or drag serialization logic changes | ⬜ Not yet |
62- | ` src/features/canvas/components/NodeOutputHandles.tsx ` | Has ` getMinimumNodeHeight() ` pure function — test if calculation logic changes | ⬜ Not yet |
65+ | ` src/features/canvas/components/NodeOutputHandles.tsx ` | Has ` getMinimumNodeHeight() ` — test if calculation logic changes | ⬜ Not yet |
6366| ` src/features/canvas/containers/AgentFlowNode.tsx ` | If warning state or color logic becomes more complex | ⬜ Not yet |
6467| ` src/features/canvas/containers/AgentFlowEdge.tsx ` | If edge deletion or interaction logic changes | ⬜ Not yet |
6568| ` src/features/canvas/containers/IterationNode.tsx ` | If resize or dimension calculation logic changes | ⬜ Not yet |
6669| ` src/atoms/ConfirmDialog.tsx ` | If promise-based confirmation pattern is modified | ⬜ Not yet |
6770| ` src/atoms/NodeInputHandler.tsx ` | If input rendering or position calculation logic changes | ⬜ Not yet |
6871| ` src/features/canvas/components/ConnectionLine.tsx ` | If edge label determination logic becomes more complex | ⬜ Not yet |
6972| ` src/features/canvas/components/NodeStatusIndicator.tsx ` | If status-to-color/icon mapping expands | ⬜ Not yet |
70- | ` src/Agentflow.tsx ` | Integration test — dark mode integration (data-dark-mode attribute, Controls class), ThemeProvider wrapper, theme switching, CSS variables injection/cleanup , header rendering, component structure, generate flow dialog (open/close/onGenerated) , imperative ref | ✅ Done |
73+ | ` src/Agentflow.tsx ` | Integration test — dark mode, ThemeProvider, CSS variables, header rendering, generate flow dialog, imperative ref | ✅ Done |
7174
7275Files that are pure styling or data constants (` styled.ts ` , ` nodeIcons.ts ` , ` MainCard.tsx ` , ` Input.tsx ` , etc.) do not need dedicated tests.
7376
@@ -106,28 +109,29 @@ This custom environment intercepts `require('canvas')` at the module level and r
106109** ReactFlow Mock** (` src/__mocks__/reactflow.tsx ` ): Provides mock implementations of ReactFlow components and hooks.
107110
108111Key features:
109- - Uses ` forwardRef ` for MUI ` styled() ` compatibility (prevents emotion errors)
110- - Uses ` useState ` internally to maintain stable references (prevents infinite re-render loops)
111- - Exports all commonly used ReactFlow components (` Controls ` , ` MiniMap ` , ` Background ` , etc.)
112- - Mocks hooks (` useNodesState ` , ` useEdgesState ` , ` useReactFlow ` )
112+
113+ - Uses ` forwardRef ` for MUI ` styled() ` compatibility (prevents emotion errors)
114+ - Uses ` useState ` internally to maintain stable references (prevents infinite re-render loops)
115+ - Exports all commonly used ReactFlow components (` Controls ` , ` MiniMap ` , ` Background ` , etc.)
116+ - Mocks hooks (` useNodesState ` , ` useEdgesState ` , ` useReactFlow ` )
113117
114118** Axios Mock** (` src/__mocks__/axios.ts ` ): Prevents network errors by mocking all HTTP requests. Returns empty arrays/objects for all API calls to silence network warnings in tests.
115119
116120** CSS Mock** (` src/__mocks__/styleMock.js ` ): Empty object export for CSS imports.
117121
118122## Configuration
119123
120- - ** Jest config** : ` jest.config.js ` — two projects: ` unit ` (node env, ` .test.ts ` ) and ` components ` (custom jsdom env, ` .test.tsx ` )
121- - ** Test environment** : Component tests use custom jsdom environment (` src/__test_utils__/jest-environment-jsdom.js ` ) to handle canvas loading
122- - ** Import aliases** : ` @test-utils ` maps to ` src/__test_utils__ ` for convenient imports
123- - ** Coverage thresholds** : uniform 80% floor (` branches ` , ` functions ` , ` lines ` , ` statements ` ) enforced per-path:
124- - ` ./src/Agentflow.tsx `
125- - ` ./src/core/ `
126- - ` ./src/features/node-palette/search.ts `
127- - ` ./src/infrastructure/api/ `
128- - ** Coverage exclusions** :
129- - ` src/__test_utils__/** ` — test utilities
130- - ` src/__mocks__/** ` — module mocks
131- - ` src/infrastructure/api/hooks/useApi.ts ` — potentially deprecated
132- - ** CI** : ` pnpm test:coverage ` runs in GitHub Actions between lint and build
133- - ** Reports** : ` coverage/lcov-report/index.html ` for detailed HTML report
124+ - ** Jest config** : ` jest.config.js ` — two projects: ` unit ` (node env, ` .test.ts ` ) and ` components ` (custom jsdom env, ` .test.tsx ` )
125+ - ** Test environment** : Component tests use custom jsdom environment (` src/__test_utils__/jest-environment-jsdom.js ` ) to handle canvas loading
126+ - ** Import aliases** : ` @test-utils ` maps to ` src/__test_utils__ ` for convenient imports
127+ - ** Coverage thresholds** : uniform 80% floor (` branches ` , ` functions ` , ` lines ` , ` statements ` ) enforced per-path:
128+ - ` ./src/Agentflow.tsx `
129+ - ` ./src/core/ `
130+ - ` ./src/features/node-palette/search.ts `
131+ - ` ./src/infrastructure/api/ `
132+ - ** Coverage exclusions** :
133+ - ` src/__test_utils__/** ` — test utilities
134+ - ` src/__mocks__/** ` — module mocks
135+ - ` src/infrastructure/api/hooks/useApi.ts ` — potentially deprecated
136+ - ** CI** : ` pnpm test:coverage ` runs in GitHub Actions between lint and build
137+ - ** Reports** : ` coverage/lcov-report/index.html ` for detailed HTML report
0 commit comments