Skip to content

Recover the dashboard search template's coverage by rendering its real children #7626

Description

@aglinxinyuan

Task Summary

frontend/src/app/dashboard/component/user/search/search.component.html reports 0 of 35 lines covered while its own .component.ts sits at 93%. That pairing is the signature of attribution loss, not of an untested template.

The cause is issue #7458: the spec stubs its child components out with TestBed.overrideComponent, and any override makes Angular re-JIT the component from its retained decorator metadata. The re-compiled template function carries no source map back to the .html, so every binding still executes and none of it is attributed.

The remedy is proven — merged PR #7535 applied it to hub-workflow-detail.component.html and took it from 0/46 to 45/46. Do not remove the override from the existing tests; append a new describe block that configures its own TestBed with no override, imports the real children, satisfies their DI, and asserts on the rendered DOM. That leaves the existing tests and their stubs untouched, which matters because de-stubbing wholesale would mean rewriting assertions that depend on the mocks.

Two things to get right, both learned from #7535:

  1. Assert on the rendered DOM, not on class state. A first draft there asserted a class flag the component sets either way, so no template mutation could reach it.
  2. Re-measure the .html record in lcov before and after. The whole point is that attribution returns, so verify it rather than assuming.

Five more templates in this repo sit at 0% for the same reason (agent-panel, user-project, workspace, hub-search-result, and this one), so the pattern is worth reusing.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions