test(frontend): extend OperatorMetadataService unit test coverage#6602
Conversation
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
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
flushMetadatahelper to consistently flush the constructor-triggered metadata GET request withmockOperatorMetaData. - Added unit tests covering
getOperatorMetadata,getOperatorSchema(success + error cases), andoperatorTypeExists(pre-fetch, user-friendly-name filter, and case-insensitive matching).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e569335 to
5063041
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 lightlytouched this. Adds 8 tests using
HttpClientTestingModule, each flushing themetadata GET with the
mockOperatorMetaDatafixture. No production code changed.getOperatorMetadata— emits the fetched metadata to subscribers.getOperatorSchema— returns the matchingOperatorSchemafor a knowntype; throws for an unknown type; throws "operator metadata is undefined"
before the request resolves.
operatorTypeExists—truefor a fetched type,falsefor an unknownone 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 wasverified by breaking an assertion to confirm the suite goes red):
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])