test: add real test cases for PresetService spec #4991
Merged
aglinxinyuan merged 6 commits intoapache:mainfrom May 9, 2026
Merged
test: add real test cases for PresetService spec #4991aglinxinyuan merged 6 commits intoapache:mainfrom
aglinxinyuan merged 6 commits intoapache:mainfrom
Conversation
Contributor
Author
|
/request-review @aglinxinyuan |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the previously commented-out PresetService spec with a runnable Vitest suite and re-enables that spec file in the Angular/Vitest test configuration so it executes in CI.
Changes:
- Replaced
preset.service.spec.tsplaceholder with real unit tests using stubbedUserConfigServiceandNzMessageService. - Re-enabled
preset.service.spec.tsby removing it from the test exclusion lists intsconfig.spec.jsonandangular.json.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| frontend/src/tsconfig.spec.json | Removes preset.service.spec.ts from the excluded specs so it’s compiled/executed. |
| frontend/angular.json | Removes preset.service.spec.ts from the unit-test builder’s exclude list so Vitest runs it. |
| frontend/src/app/workspace/service/preset/preset.service.spec.ts | Adds a full Vitest test suite for PresetService, including preset I/O, operator application, validation, and static helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aglinxinyuan
approved these changes
May 9, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4991 +/- ##
============================================
+ Coverage 42.73% 42.95% +0.21%
Complexity 2187 2187
============================================
Files 1031 1031
Lines 38152 38153 +1
Branches 4004 4004
============================================
+ Hits 16305 16389 +84
+ Misses 20831 20742 -89
- Partials 1016 1022 +6
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Replaces the old all-commented-out preset.service.spec.ts with a real, runnable Vitest test suite for PresetService, and re-enables the file in angular.json and tsconfig.spec.json (it was previously excluded from the build).
The new suite uses fake UserConfigService and NzMessageService providers and covers:
deletePreset / getPresets happy paths and error cases.
Also registers the project's custom "enable-presets" Ajv keyword as a no-op in the test file so Ajv 8 strict mode doesn't reject the operator schemas at compile time.
Any related issues, documentation, or discussions?
Closes: #4968
Was this PR authored or co-authored using generative AI tooling?
Co-Authored with Claude Opus 4.7 in compliance with ASF