test(frontend): cover WorkflowEditorComponent connection validation, clipboard, and delete paths#6829
test(frontend): cover WorkflowEditorComponent connection validation, clipboard, and delete paths#6829mengw15 wants to merge 3 commits into
Conversation
…clipboard, and delete paths
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
Extends the Angular unit test suite for WorkflowEditorComponent to cover previously untested non-rendering behaviors (logic that does not require real JointJS dia.Paper geometry / browser-mode), aligning with the scope in Issue #6827.
Changes:
- Adds unit tests for connection validation (
validateJointOperatorConnectionandvalidateOperatorConnectionguard cases). - Adds unit tests for keyboard-driven delete/select-all paths to ensure links and comment boxes are included, not only operators.
- Adds unit tests for clipboard handlers (copy/cut/paste) and for repaint behavior when operators are disabled/re-enabled.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6829 +/- ##
============================================
+ Coverage 76.44% 76.50% +0.06%
+ Complexity 3456 3450 -6
============================================
Files 1161 1161
Lines 45922 45919 -3
Branches 5101 5100 -1
============================================
+ Hits 35105 35131 +26
+ Misses 9269 9241 -28
+ Partials 1548 1547 -1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What changes were proposed in this PR?
Extends the existing
WorkflowEditorComponentspec with the file's non-renderingslice — connection validation, the clipboard handlers, and the delete /
select-all paths the keyboard tests never reach. The paper-event and pointer
handlers stay out of scope (they need real
dia.Papergeometry / browser mode).12 new tests take the component from 68.6% to 74.0% statement coverage (+31
lines) and bring every targeted method to 100%:
validateJointOperatorConnection— rejects a link drawn out of an input portand one dropped onto an output port; delegates an output→input pair to the
operator-level check (proved by re-running once the link exists).
validateOperatorConnectionguards — self-connection, a missing port oneither end, and an endpoint that is not an operator.
deleteElements— highlighted links and comment boxes are deleted, not justoperators.
handleElementSelectAll— ⌘/Ctrl+A also highlights links and comment boxes.handleElementCopy/handleElementCut/handleElementPaste— copy cachesthe selection, cut caches then deletes it, paste delegates to the operator menu.
handleDisableOperator— repaints the operator on disable and on re-enable.No production code was changed.
Any related issues, documentation, discussions?
Closes #6827.
How was this PR tested?
ng test --watch=false --include src/app/workspace/component/workflow-editor/workflow-editor.component.spec.ts— 57 passed (45 existing + 12 new), run 3× for determinism. The failure path was
verified by breaking an assertion (red, non-zero exit), and eslint/prettier are
clean. Coverage was measured with
--coveragebefore and after to confirm eachtargeted method reached 100%.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])