Skip to content

test(frontend): add unit test coverage for formly-utils field helpers#6365

Merged
mengw15 merged 2 commits into
apache:mainfrom
mengw15:chore/6361-formly-utils-test
Jul 12, 2026
Merged

test(frontend): add unit test coverage for formly-utils field helpers#6365
mengw15 merged 2 commits into
apache:mainfrom
mengw15:chore/6361-formly-utils-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Add unit test coverage for the pure FormlyFieldConfig helpers in frontend/src/app/common/formly/formly-utils.tsgetFieldByName, setHideExpression, and the createShouldHideFieldFunc predicate factory. A Vitest spec on plain objects (no TestBed). No production-code changes.

The rxjs createOutputFormChangeEventStream (debounce/distinct/share stream) is out of scope for this issue.

Any related issues, documentation, discussions?

Closes #6361. See frontend/TESTING.md.

How was this PR tested?

ng test --watch=false --include src/app/common/formly/formly-utils.spec.ts

9 pass. ESLint and Prettier on the new spec are clean. The spec is pure — it builds plain FormlyFieldConfig objects (no TestBed) and covers: getFieldByName (match / no-match / first-of-duplicate-keys); setHideExpression (sets the hide expression on present fields, no-op for absent names); and the createShouldHideFieldFunc predicate (missing model → false, null target → hideOnNull, anchored regex match, and equals via toString()).

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

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

Cover the pure FormlyFieldConfig helpers getFieldByName, setHideExpression,
and the createShouldHideFieldFunc predicate factory with a Vitest spec on
plain objects (no TestBed). The rxjs createOutputFormChangeEventStream is
out of scope for this issue.

Closes apache#6361.
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Jul 12, 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.

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

Adds frontend unit test coverage for the pure FormlyFieldConfig helpers in frontend/src/app/common/formly/formly-utils.ts, using Vitest on plain object field configs (no Angular TestBed). This improves confidence in the small utility behaviors while keeping production code unchanged.

Changes:

  • Added a new Vitest spec covering getFieldByName match/no-match/first-duplicate behavior.
  • Added tests for setHideExpression (sets hide expression for existing fields; no-op for missing names).
  • Added tests for createShouldHideFieldFunc covering missing model, null/undefined target handling, regex matching, and equals matching via toString().

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

Comment thread frontend/src/app/common/formly/formly-utils.spec.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Meng Wang <mengw15@uci.edu>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.44%. Comparing base (df8f133) to head (ca068ef).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6365      +/-   ##
============================================
+ Coverage     65.43%   65.44%   +0.01%     
  Complexity     3382     3382              
============================================
  Files          1142     1142              
  Lines         44980    44980              
  Branches       4948     4948              
============================================
+ Hits          29432    29438       +6     
+ Misses        13928    13923       -5     
+ Partials       1620     1619       -1     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from df8f133
agent-service 51.90% <ø> (ø) Carriedforward from df8f133
amber 66.58% <ø> (ø) Carriedforward from df8f133
computing-unit-managing-service 9.97% <ø> (ø) Carriedforward from df8f133
config-service 52.30% <ø> (ø) Carriedforward from df8f133
file-service 63.97% <ø> (ø) Carriedforward from df8f133
frontend 62.09% <ø> (+0.04%) ⬆️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from df8f133
pyamber 91.18% <ø> (ø) Carriedforward from df8f133
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from df8f133

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

@mengw15 mengw15 requested review from aglinxinyuan and xuang7 July 12, 2026 07:21

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

@mengw15 mengw15 added this pull request to the merge queue Jul 12, 2026
Merged via the queue into apache:main with commit afa8af2 Jul 12, 2026
21 checks passed
@mengw15 mengw15 deleted the chore/6361-formly-utils-test branch July 12, 2026 07:38
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 formly-utils pure field helpers

4 participants