test(frontend): render the dashboard search with its real children - #7627
Merged
Conversation
search.component.html reported 0 of 35 lines covered while its own .ts sat at 93%. That is not an untested template - it is the attribution loss recorded in apache#7458: the spec stubs its children out through TestBed.overrideComponent, and any override makes Angular re-JIT the component from its decorator metadata, leaving the re-compiled template with no source map back to the .html. Adds a describe block that renders the component with its real children, which restores attribution: the template goes from 0/35 to 35/35 lines and 6/6 functions, and the .ts rises too. The block keeps its own TestBed so the 15 existing tests keep their stubs untouched. No production file is touched.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7627 +/- ##
============================================
- Coverage 89.67% 89.40% -0.28%
+ Complexity 4403 4357 -46
============================================
Files 1176 1177 +1
Lines 46992 46871 -121
Branches 5268 5245 -23
============================================
- Hits 42142 41903 -239
- Misses 3090 3216 +126
+ Partials 1760 1752 -8
*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:
|
This was referenced Aug 14, 2026
renovate-bot
pushed a commit
to renovate-bot/apache-_-texera
that referenced
this pull request
Aug 15, 2026
…pache#7661) ### What changes were proposed in this PR? `hub-search-result.component.html` reported **0 of 23 lines, 0 of 8 branches and 0 of 3 functions** covered, behind a 17-test spec. That is the attribution loss from apache#7458, not an untested template: the spec swaps its four children for same-selector stubs via `TestBed.overrideComponent`, and any override re-JITs the component from its decorator metadata, leaving the recompiled template with no source map back to the `.html`. Adds a `describe` block that renders the component with its **real** children: | | Before | After | |---|---|---| | lines | 0/23 | **23/23** | | branches | 0/8 | **8/8** | | functions | 0/3 | **3/3** | The block keeps its own `TestBed`, so the 17 existing tests keep their stubs and assertions untouched. Same remedy as merged PRs apache#7535, apache#7627 and apache#7629 — this is the last of the six templates apache#7458 identified, bar `workspace` and the `user-project` one that the project-feature removal deletes. Covered: the real children resolving rather than the stub selectors, the dataset-only view toggle and its absence for workflows, which toggle button is highlighted, the sort options shown and hidden per search type, the sort handler's two halves, the card template and its `viewMode` guard, and the three inputs handed to the results list. ### Verification 23 mutations applied and reverted, production diff empty each time. **Two then turned out to survive, and the cause is worth recording.** The view-toggle helper read each button as `classList.contains("ant-btn-primary")`, which pins a ternary's *true* leg only — so changing the false leg from `'default'` to `'dashed'` or `'link'` shipped green. The build's own mutations replaced the whole ternary with a constant, which flips the primary leg and dies, which is exactly why the gap was missed. The helper now reads the type by **name**, matched against the nzType names rather than any `ant-btn-*` class, since the buttons also carry `ant-btn-icon-only` — my first attempt at the fix picked that modifier up and failed loudly, which is how I found it. All three are now red, each on the intended test rather than merely somewhere in the suite: | Mutation | Result | Failing test | |---|---|---| | list button's false leg → `dashed` | red | "highlights whichever view-toggle button matches…" | | card button's false leg → `link` | red | same | | list button collapsed to a constant (control) | red | same | ### Deliberately not included A static `nzTheme="outline"` attribute carries no lcov line and is not asserted. No production file is touched. ### Any related issues, documentation, discussions? Closes apache#7660 ### How was this PR tested? ``` npx ng test --watch=false --include="**/hub-search-result.component.spec.ts" ``` ``` Test Files 1 passed (1) Tests 27 passed (27) ``` 10 new on top of the existing 17. Coverage re-measured by reverting the spec, running with `--coverage`, and restoring. `yarn format:ci` passes. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5)
6 tasks
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?
search.component.htmlreported 0 of 35 lines covered while its own.tssat at 93%. That is the attribution loss from #7458, not an untested template: the spec stubs its children out throughTestBed.overrideComponent, and any override re-JITs the component from its decorator metadata, so the re-compiled template has no source map back to the.htmland its bindings execute uncounted.Adds a
describeblock that renders the component with its real children, which restores attribution:search.component.htmllinessearch.component.htmlfunctionssearch.component.tslinessearch.component.tsbranchesThe block keeps its own
TestBed, so the 15 existing tests keep their stubs and assertions untouched. Same remedy as merged PR #7535.Verification
16 mutations applied and reverted, production diff empty each time. Five were then run independently, chosen against the failure modes rather than repeating the list:
[currentUid]from the child binding(sortMethodChange)no longer assignsnz-iconspannz-iconreally derives itsanticon-*class under jsdom[showResourceTypes]="true"→"false"I ran a sixth of my own afterwards — unwiring the All-type button — and it is red.
Deliberately not included
[showResourceTypes]is reported rather than pinned: repo-wide grep shows the consuming component never varies it, so the flag has one value in practice and no assertion can distinguish the two.No production file is touched.
Any related issues, documentation, discussions?
Closes #7626
How was this PR tested?
7 new on top of the existing 15. Coverage re-measured from scratch by reverting the spec, running with
--coverage, then restoring.yarn format:cipasses.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)