aglinxinyuan opened a new pull request, #7354:
URL: https://github.com/apache/texera/pull/7354
### What changes were proposed in this PR?
`OperatorMenuComponent` had **4 tests across 153 lines**, all of them about
the search box. Two whole areas were untested.
**The constructor's metadata subscription** — this is what actually
populates the palette:
```
metadata -> filter out PythonUDF / Dummy -> bucket by operatorGroupName ->
sort each bucket
-> fuse.setCollection(ops)
```
A regression here silently drops operators from the palette or reshuffles
them, with nothing failing. Four tests cover the bucketing, the per-group sort,
and that `groupNames` comes from the metadata rather than being derived from
the operators present — deriving it would silently drop a heading whenever a
group happens to be empty.
The PythonUDF test asserts absence from **both** the palette and the search
index, because the filter feeds both `opList` and `fuse.setCollection`.
Asserting only the palette would miss a filter applied in one place only.
**`onSelectionChange` was untested entirely.** It places the new operator
relative to the canvas pan offset, so the arithmetic is asserted against a
paper translated by (100, 25) — the operator must land at **(300, 175)**, not
the raw (400, 200). The no-paper fallback is covered too, since the `?? 0`
guards exist for the window before the editor mounts.
A third test pins that the search box clears **asynchronously**, and
deliberately asserts the value is *still set* immediately after the call. That
is not an accident of the implementation: ng-zorro re-displays the selected
value if it is cleared synchronously, which is why the `setTimeout` is there. A
test that only checked the end state would pass with the `setTimeout` removed.
Also covers `canModify` tracking the workflow-modification stream — the
palette disables drag-and-drop on that flag, so a stuck value lets a user drag
operators onto a read-only workflow.
**Assertion strength measured by mutation**, all reverted (component diff
empty):
| Mutation | Result |
|---|---|
| replace the per-group sort with `reverse()` | red |
| stop filtering `PythonUDF` | red |
| ignore the pan offset | red |
| clear the search box synchronously | red |
Not covered, and worth stating: the `Sleep` handling is asymmetric — it is
excluded from `opList` but left in the fuse collection, so it is searchable
without being listed. The standard `StubOperatorMetadataService` fixture
contains no `Sleep` operator, so pinning that would need a custom metadata
provider; noted here rather than half-tested.
No production file is touched.
### Any related issues, documentation, discussions?
Closes #7352
### How was this PR tested?
```
npx ng test --watch=false --include="**/operator-menu.component.spec.ts"
```
```
✓
src/app/workspace/component/left-panel/operator-menu/operator-menu.component.spec.ts
(12 tests)
Test Files 1 passed (1)
```
8 new tests on top of the existing 4. `yarn format:ci` passes.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)
--
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]