Ma77Ball opened a new pull request, #5009:
URL: https://github.com/apache/texera/pull/5009
### What changes were proposed in this PR?
Replaces the placeholder/commented-out body of
preset-wrapper.component.spec.ts with a real Vitest suite for
PresetWrapperComponent, and re-enables the file in angular.json and
tsconfig.spec.json (it was previously excluded from the build).
The new suite uses fake PresetService and NzMessageService providers and
covers:
- ngOnInit guards: throws when field.key, templateOptions, or presetKey
are missing; populates searchResults from getPresets.
- Functional API: applyPreset / deletePreset forward to PresetService with
the configured preset key triple; getEntryTitle, getEntryDescription, and the
show-all / prefix-match / empty-term / no-match branches of
getSearchResults.
- Dropdown visibility: opening re-fetches presets, closing does not.
- Stream subscriptions: savePresetsStream updates searchResults only when
type + target match; valueChanges only refreshes while the menu is open;
ngOnDestroy tears down subscriptions.
- savePreset: builds the payload from sibling preset-wrapper fields
(ignoring non-preset siblings) and routes valid presets to createPreset;
invalid presets surface a toast error.
### Any related issues, documentation, or discussions?
Closes: #4963
### How was this PR tested?
`npx ng test --watch=false
--include='src/app/common/formly/preset-wrapper/preset-wrapper.component.spec.ts'`
--> 24 tests pass locally under the Vitest runner.
Was this PR authored or co-authored using generative AI tooling?
### Was this PR authored or co-authored using generative AI tooling?
Co-Authored with Claude Opus 4.7 in compliance with ASF.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]