test(frontend): add unit test coverage for ContextMenuComponent actions - #7148
Queued
eugenegujing wants to merge 1 commit into
Queued
test(frontend): add unit test coverage for ContextMenuComponent actions#7148eugenegujing wants to merge 1 commit into
eugenegujing wants to merge 1 commit into
Conversation
Extends `context-menu.component.spec.ts` with 16 tests for the previously untested action surface of `ContextMenuComponent`: `onCopy`/`onPaste` delegation to `OperatorMenuService`, `onCut` copy-before-delete ordering, `onDelete` (all deletions in one `bundleActions` call, the `hasLinkWithID` guard against double-deleting a link removed with its operator, id snapshot before mutation, plus four tests through the real `WorkflowActionService` on a seeded graph including single-undo-step restoration), `hasHighlightedLinks`, the `onClickExportHighlightedExecutionResult` modal parameters, and the two constructor highlight subscriptions. No production code is changed.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7148 +/- ##
============================================
+ Coverage 79.59% 79.64% +0.04%
Complexity 3839 3839
============================================
Files 1159 1159
Lines 46122 46162 +40
Branches 5127 5133 +6
============================================
+ Hits 36710 36764 +54
+ Misses 7787 7773 -14
Partials 1625 1625
*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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
ContextMenuComponentbacks the canvas right-click menu, but its existing 13 tests only covercanExecuteOperatorand its helpers; none of the action methods was invoked by any test.This PR extends
context-menu.component.spec.tswith 16 tests covering the remaining public surface:onCopy/onPaste: delegate toOperatorMenuService, each also asserting the sibling method is not called.onCut: copy happens before delete (asserted via mock invocation order).onDelete(mocked): all three deletion kinds are issued with the snapshotted id lists inside exactly onebundleActionscall; nothing is deleted when thebundleActionscallback is not run; thehasLinkWithIDguard skips links no longer in the graph; highlighted ids are snapshotted before deletion mutates the live highlight arrays.onDelete(realWorkflowActionServiceon a seeded graph): deleting an operator together with its attached highlighted link does not double-delete the link (the realdeleteLinkWithIDthrows on a missing link); a standalone highlighted link is deleted while its endpoint operators survive; highlighted comment boxes are deleted; the whole mixed deletion is a single undo stack entry that one undo fully restores.hasHighlightedLinks: false/true per link highlight state.onClickExportHighlightedExecutionResult: modal opens withResultExportationComponent, the workflow name, and thecontext-menusource marker.highlightedOperatorIds/highlightedCommentBoxIdsfollow the service stream emissions.No production code is changed. The only shared-stub change is the
OperatorMenuServicestub's two highlight streams becomingBehaviorSubjects instead ofof([])so the subscription tests can push emissions; both emit[]on subscribe, so the pre-existing tests are unaffected.Any related issues, documentation, discussions?
Closes #7147
How was this PR tested?
This PR only adds tests. From
frontend/,npx ng test --watch=false --include='**/context-menu.component.spec.ts'passes 29/29 (13 pre-existing + 16 new); prettier and eslint are clean. With coverage enabled,context-menu.component.tsreaches 100% statements, functions and branches.Was this PR authored or co-authored using generative AI tooling?
Co-authored by: Claude Code (Claude Fable 5)