Skip to content

test(frontend): extend OperatorMetadataService unit test coverage#6602

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/6592-operator-metadata-service-test
Jul 20, 2026
Merged

test(frontend): extend OperatorMetadataService unit test coverage#6602
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/6592-operator-metadata-service-test

Conversation

@mengw15

@mengw15 mengw15 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends the existing Vitest spec for OperatorMetadataService
(frontend/src/app/workspace/service/operator-metadata/operator-metadata.service.ts,
codecov ~56%). The service fetches operator metadata once over HTTP (cached via
shareReplay) and serves lookups from it; the existing spec only lightly
touched this. Adds 8 tests using HttpClientTestingModule, each flushing the
metadata GET with the mockOperatorMetaData fixture. No production code changed.

  • getOperatorMetadata — emits the fetched metadata to subscribers.
  • getOperatorSchema — returns the matching OperatorSchema for a known
    type; throws for an unknown type; throws "operator metadata is undefined"
    before the request resolves.
  • operatorTypeExiststrue for a fetched type, false for an unknown
    one and before the request resolves; matches the user-friendly name only when
    that filter is enabled; honors case-insensitive matching when requested.

Any related issues, documentation, discussions?

Closes #6592

How was this PR tested?

Extended unit tests, run locally in frontend/ (all green; the failure path was
verified by breaking an assertion to confirm the suite goes red):

ng test --watch=false --include src/app/workspace/service/operator-metadata/operator-metadata.service.spec.ts
# Tests  11 passed (11)   (3 existing + 8 new)
eslint <spec>       # clean
prettier --check    # clean

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

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

@mengw15
mengw15 requested a review from Copilot July 20, 2026 11:01
@mengw15 mengw15 self-assigned this Jul 20, 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:

  • Contributors with relevant context: @Yicong-Huang
    You can notify them by mentioning @Yicong-Huang in a comment.

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

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 extends the frontend unit test coverage for OperatorMetadataService by adding more thorough Vitest cases around metadata fetching/caching and schema/type lookup behaviors. It strengthens confidence in the service’s observable caching and error/edge-case handling without changing production code.

Changes:

  • Added a shared flushMetadata helper to consistently flush the constructor-triggered metadata GET request with mockOperatorMetaData.
  • Added unit tests covering getOperatorMetadata, getOperatorSchema (success + error cases), and operatorTypeExists (pre-fetch, user-friendly-name filter, and case-insensitive matching).

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

@mengw15
mengw15 force-pushed the chore/6592-operator-metadata-service-test branch from e569335 to 5063041 Compare July 20, 2026 11:25
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.01%. Comparing base (c543d77) to head (5063041).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6602      +/-   ##
============================================
+ Coverage     73.98%   74.01%   +0.03%     
  Complexity     3434     3434              
============================================
  Files          1157     1157              
  Lines         45621    45621              
  Branches       5031     5031              
============================================
+ Hits          33752    33766      +14     
+ Misses        10187    10175      -12     
+ Partials       1682     1680       -2     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from c543d77
agent-service 76.76% <ø> (ø) Carriedforward from c543d77
amber 66.78% <ø> (ø) Carriedforward from c543d77
computing-unit-managing-service 17.72% <ø> (ø) Carriedforward from c543d77
config-service 66.66% <ø> (ø) Carriedforward from c543d77
file-service 66.80% <ø> (ø) Carriedforward from c543d77
frontend 77.18% <ø> (+0.07%) ⬆️
notebook-migration-service 78.94% <ø> (ø) Carriedforward from c543d77
pyamber 91.79% <ø> (ø) Carriedforward from c543d77
workflow-compiling-service 55.14% <ø> (ø) Carriedforward from c543d77

*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 a review from aglinxinyuan July 20, 2026 19:08

@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 20, 2026
Merged via the queue into apache:main with commit dabc562 Jul 20, 2026
21 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 OperatorMetadataService

4 participants