test(frontend): add unit test coverage for NzModalCommentBoxComponent#6510
Merged
aglinxinyuan merged 1 commit intoJul 18, 2026
Merged
Conversation
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 #6510 +/- ##
============================================
+ Coverage 70.57% 70.73% +0.15%
Complexity 3425 3425
============================================
Files 1146 1146
Lines 45062 45062
Branches 4960 4960
============================================
+ Hits 31802 31873 +71
+ Misses 11613 11540 -73
- Partials 1647 1649 +2
*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:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves frontend test coverage by adding a new Vitest unit test suite for NzModalCommentBoxComponent, increasing confidence in comment-box modal behaviors without modifying production code.
Changes:
- Added an Angular TestBed-based Vitest spec for
NzModalCommentBoxComponent. - Stubbed
WorkflowActionService,UserService,NzModalRef,NotificationService, and YjscommentBoxto test component logic in isolation. - Added coverage for add/delete/edit/reply interactions and Ctrl/Cmd+Enter submission behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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?
Adds a Vitest spec for
NzModalCommentBoxComponent(
frontend/src/app/workspace/component/workflow-editor/comment-box-modal/nz-modal-comment-box.component.ts),previously without a spec (~5% coverage). TestBed +
detectChanges(), withWorkflowActionService,UserService,NzModalRef,NotificationService, andthe Yjs
commentBoxall stubbed.8 tests cover:
should createand render a comment from the box.onClickAddComment— adds the comment throughworkflowActionServicefor the current user (content / author / id + box id) and clears the input; no-op (no service call) when there is no current user.deleteComment— forwards to the service with the box id when a user is present; no-op without one.editComment— forwards the edited content to the service and resetseditValue.replyToComment— appends a quoted mention to the input.onKeyDown— submits on Ctrl/Cmd+Enter and ignores other keys.No production code was changed.
Any related issues, documentation, discussions?
Closes #6505
How was this PR tested?
New unit tests, run locally in
frontend/(all green; the failure path wasverified by deliberately breaking an assertion to confirm the suite goes red):
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])