Skip to content

test(frontend): add unit test coverage for NzModalCommentBoxComponent#6510

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/6505-comment-box-modal-test
Jul 18, 2026
Merged

test(frontend): add unit test coverage for NzModalCommentBoxComponent#6510
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/6505-comment-box-modal-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

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(), with
WorkflowActionService, UserService, NzModalRef, NotificationService, and
the Yjs commentBox all stubbed.

8 tests cover:

  • should create and render a comment from the box.
  • onClickAddComment — adds the comment through workflowActionService for 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 resets editValue.
  • 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 was
verified by deliberately breaking an assertion to confirm the suite goes red):

ng test --watch=false --include src/app/workspace/component/workflow-editor/comment-box-modal/nz-modal-comment-box.component.spec.ts
# Test Files 1 passed (1) | Tests 8 passed (8)
prettier --write <spec>   # formatted
eslint  <spec>            # clean

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.8 [1M context])

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • No candidates found from git blame history.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.73%. Comparing base (39db110) to head (812a29e).

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     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 39db110
agent-service 76.76% <ø> (ø) Carriedforward from 39db110
amber 66.72% <ø> (ø) Carriedforward from 39db110
computing-unit-managing-service 17.72% <ø> (ø) Carriedforward from 39db110
config-service 52.30% <ø> (ø) Carriedforward from 39db110
file-service 66.80% <ø> (ø) Carriedforward from 39db110
frontend 69.73% <ø> (+0.36%) ⬆️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from 39db110
pyamber 91.74% <ø> (ø) Carriedforward from 39db110
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from 39db110

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Yjs commentBox to 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.

@mengw15
mengw15 requested a review from aglinxinyuan July 18, 2026 08:13

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Jul 18, 2026
Merged via the queue into apache:main with commit 8ebcf7d Jul 18, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit test coverage for NzModalCommentBoxComponent

4 participants