Skip to content

test: cover ShareAccessComponent behaviors in spec#5233

Open
Ma77Ball wants to merge 3 commits into
apache:mainfrom
Ma77Ball:test/shareAccessSpec
Open

test: cover ShareAccessComponent behaviors in spec#5233
Ma77Ball wants to merge 3 commits into
apache:mainfrom
Ma77Ball:test/shareAccessSpec

Conversation

@Ma77Ball
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

  • Expand share-access.component.spec.ts from 4 routing-only tests to 44 tests grouped by behavior: ngOnInit, handleInputConfirm, onPaste, grantAccess, hasWriteAccess, verifyRevokeAccess/revokeAccess, changeAccessLevel, verifyPublish/verifyUnpublish, and the individual publish/unpublish methods.
  • Drive modal-confirmation flows by capturing the config passed to NzModalService.create and invoking the relevant nzFooter button's onClick, so each test asserts against the specific Confirm/Cancel path it cares about.
  • Parameterize the setupComponent helper with type, id, inWorkspace, and currentEmail overrides, and reset the TestBed in beforeEach so each test reconfigures providers (e.g., a WRITE access entry for hasWriteAccess, an already-published item for verifyPublish) without bleed-over.

Any related issues, documentation, or discussions?

Closes: #5223

How was this PR tested?

  • Ran yarn format:fix (touched the new spec only).
  • Ran yarn test --include="src/app/dashboard/component/user/share-access/share-access.component.spec.ts": 44/44 passing.

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

Co-authored with Claude Opus 4.7 in compliance with ASF

@Ma77Ball
Copy link
Copy Markdown
Contributor Author

/request-review @aglinxinyuan

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 expands the unit test coverage for ShareAccessComponent in the dashboard “share access” modal, moving from minimal routing assertions to behavior-focused tests that exercise the component’s access management and publish/unpublish flows.

Changes:

  • Adds comprehensive specs for ngOnInit, email tag parsing (handleInputConfirm, onPaste), and access grant behaviors (grantAccess, hasWriteAccess).
  • Adds modal-driven confirmation flow tests for revoke, access level changes, and publish/unpublish actions by capturing NzModalService.create configs and invoking footer callbacks.
  • Refactors the spec setup helper to parameterize modal data and current user email, and resets the TestBed per test to avoid provider state bleed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label May 27, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.78%. Comparing base (d5bc8b7) to head (6e63a3d).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5233      +/-   ##
============================================
+ Coverage     48.72%   48.78%   +0.05%     
- Complexity     2375     2379       +4     
============================================
  Files          1044     1042       -2     
  Lines         40096    39971     -125     
  Branches       4252     4252              
============================================
- Hits          19538    19500      -38     
+ Misses        19411    19318      -93     
- Partials       1147     1153       +6     
Flag Coverage Δ *Carryforward flag
access-control-service 39.53% <ø> (ø) Carriedforward from 8a7366f
agent-service 33.76% <ø> (ø) Carriedforward from 8a7366f
amber 51.58% <ø> (+0.02%) ⬆️ Carriedforward from 8a7366f
computing-unit-managing-service 0.00% <ø> (ø) Carriedforward from 8a7366f
config-service 0.00% <ø> (ø) Carriedforward from 8a7366f
file-service 37.99% <ø> (ø) Carriedforward from 8a7366f
frontend 40.54% <ø> (+0.51%) ⬆️
python 90.46% <ø> (-0.34%) ⬇️ Carriedforward from 8a7366f
workflow-compiling-service 56.81% <ø> (ø) Carriedforward from 8a7366f

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

☔ View full report in Codecov by Sentry.
📢 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.

@aglinxinyuan aglinxinyuan added this pull request to the merge queue May 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 27, 2026
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 spec coverage for share-access.component.ts

4 participants