Skip to content

test(frontend): add unit tests for UserProjectSectionComponent#6835

Open
Musxeto wants to merge 2 commits into
apache:mainfrom
Musxeto:test/user-project-section
Open

test(frontend): add unit tests for UserProjectSectionComponent#6835
Musxeto wants to merge 2 commits into
apache:mainfrom
Musxeto:test/user-project-section

Conversation

@Musxeto

@Musxeto Musxeto commented Jul 23, 2026

Copy link
Copy Markdown

What changes were proposed in this PR?

Adds Vitest unit test coverage for UserProjectSectionComponent (user-project-section.component.spec.ts) covering:

  • Route-driven project metadata loading via ActivatedRoute URL params (getUserProjectMetadata, retrieveProject, getProjectList, refreshFilesOfProject, component field bindings, and handling of malformed route segments).
  • Cached project file retrieval (getUserProjectFilesArray) and fallback to an empty array [].
  • Project color updates (updateProjectColor) for valid HEX formats, invalid HEX notification handling, and ignoring unchanged values.
  • Project color removal (removeProjectColor) for populated and missing/null color states.

No production source code files were modified.

Any related issues, documentation, discussions?

Closes #6634

How was this PR tested?

Ran Vitest unit tests via Angular CLI:
npx ng test --include src/app/dashboard/component/user/user-project/user-project-section/user-project-section.component.spec.ts

Result: 7 passed, 1 failed (8 total tests).

 FAIL  |gui| src/app/dashboard/component/user/user-project/user-project-section/user-project-section.component.spec.ts > UserProjectSectionComponent > returns cached files from the service and falls back to an empty list
AssertionError: expected [] to be [ { file: { name: 'file-1' } } ] // Object.is equality

- Expected
+ Received

- [
-   {
-     "file": {
-       "name": "file-1",
-     },
-   },
- ]
+ []

 Test Files  1 failed (1)
      Tests  1 failed | 7 passed (8)

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

No

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your first contribution to Texera, @Musxeto!

If you're looking for a good place to start, browse issues labeled starter-task; they're scoped to be approachable for newcomers.

You can drive common housekeeping yourself by commenting one of these commands on its own line:

  • Issues. Comment /take to assign an open issue to yourself, or /untake to release it. You can find unclaimed work with the search filter is:issue is:open no:assignee.
  • Sub-issues. To link issues into a parent/child hierarchy, comment /sub-issue #5166 #5222 on the parent to attach those children (or /unsub-issue #5166 #5222 to detach them). From a child issue, comment /parent-issue #5166 to set its parent, or /unparent-issue to clear it (the current parent is detected automatically). References may be written as #5166 or as a bare 5166; cross-repository references are not supported.
  • Pull requests (author only). Comment /request-review @user to request a review from someone, or /unrequest-review @user to withdraw that request.

Each command must match exactly: /take this will not work, only /take does. For the full contribution flow, see CONTRIBUTING.md.

@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.

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

Musxeto commented Jul 23, 2026

Copy link
Copy Markdown
Author

/request-review @Ma77Ball

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.28%. Comparing base (dda9e83) to head (ffb0043).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #6835   +/-   ##
=========================================
  Coverage     76.28%   76.28%           
  Complexity     3452     3452           
=========================================
  Files          1161     1161           
  Lines         45916    45916           
  Branches       5099     5099           
=========================================
  Hits          35025    35025           
  Misses         9327     9327           
  Partials       1564     1564           
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from dda9e83
agent-service 76.76% <ø> (ø) Carriedforward from dda9e83
amber 67.33% <ø> (ø) Carriedforward from dda9e83
computing-unit-managing-service 20.49% <ø> (ø) Carriedforward from dda9e83
config-service 66.66% <ø> (ø) Carriedforward from dda9e83
file-service 67.21% <ø> (ø) Carriedforward from dda9e83
frontend 81.72% <ø> (ø) Carriedforward from dda9e83
notebook-migration-service 78.94% <ø> (ø) Carriedforward from dda9e83
pyamber 92.15% <ø> (ø) Carriedforward from dda9e83
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from dda9e83

*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.

@Musxeto

Musxeto commented Jul 24, 2026

Copy link
Copy Markdown
Author

/request-review @xuang7

@github-actions
github-actions Bot requested a review from xuang7 July 24, 2026 16:51
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 UserProjectSectionComponent

2 participants